c# - Calling a Dynamic String from one class to another -


i new c# , tried call string variable 1 class another.

it works fine. string called 1 assigned public @ top.

in runtime string changes , can't string variable dynamic. please me in getting dynamic string value 1 class another.

right, presuming have 2 classes.

class class1 {     public string string1;     //code class1 } class class2 {     class1 c1 = new class1();     string string1 = c1.string1; } 

the first class contains public string, , second class contains access public string. however, when add method second class calls string, call string when class initialised.

to make method call latest version of string use this:

    class class1 {     public string string1;     //code class1 } class class2 {     class1 c1 = new class1();     public void method1 {         var string1 = c1.string1;     } } 

i believe fix issue, comment if doesn't help.

references: experience, mdsn


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -