i have three class. First Class where i declare property,in second class i set property value and third class for use its value.but in third class property is empty.
class1
class first { public string first{get; set;} } class2
class second
{ public second() { first f1=new first(); f1.first="hello"; } }
class third
class third { public third() { first f1=new first(); string nn=f1.first; } }
Loading
VulpesPosted Feb 6, 2015, 6:02 PM
However, subject to that, in the third class's constructor you're not actually setting the first property which will therefore still have its default value of null as it's of string type.
Consequently, 'nn' will be null too.