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; } }
Property lost when another class call it
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Feb 6, 2015, 1:02 PM EST
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.