c# - initialization of two variables at the same time -


is there way initialize these 2 variable @ same time?

in example "time" variable can "" or has value.

var variable1 = string.isnullorempty(time) ? string.empty : "value"; var variable2 = string.isnullorempty(time) ? "value" : string.empty; 

not possible. can create helper class hold 2 variables. or can use out-of-the-box, tuple:

var variable = string.isnullorempty(time) ? tuple.create(string.empty, "value")                                            : tuple.create("value", string.empty); 

and access 2 values variable.item1 , variable.item2.

note: use wisely variables in general better because have names, , hence - meaning. many tuples item1 , item2 can fast become unclear, intended for.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -