c# - Dynamically returning property values -
i have class like:
class { public double? londontime { get; set; } public double? delhitime { get; set; } } now, in class, want make these properties dynamic. class b has function foo(classa):
class b private void foo(class a) double d; { if(some condition london time) { //how pass londontime property d = returntime(); } else if(some condition delhi time) { //how pass delhitimeproperty d = returntime(); } } private double returntime(????) //what should pass here argument { if(londontimeproperty passed) { logic } if(delhitimeproperty passed) { logic } return 0; } here, example, if giving me 1 dynamic value, can adjust it.
so, there way pass argument in returntime based on condition , know return ?
some general questions , comments:
why using double instead of datetime?
what mean dynamic?
it seems need this:
double? getlondontime(a a) { //some logic } double? getdelhitime(a a) { //some logic } void foo(a a) { if(some condition delhi) return getdelhitime(a); if(some condition london) return getlondontime(a); return 0; } if using datetime, determine if delhi or london time based on timezone.
Comments
Post a Comment