Hello dear,
in C# when you want to access to a property or variable of a class, you should declare that variable as static:
Code:
public class firstClass
{
public static string myVar = "";
// set value in some function
void mySetFunction()
{
myVar = "sample text";
}
}
public class secondClass
{
// read value in other function in secondClass
void UseMyVar()
{
... = firstClass.myVar;
}
}
notice that the only way you can share a variable between classes, is declaring variable as static