Is there anyway to do this? Its like i have a class
public class TestClass
{
public static string myString= "123";
}
I want to some how get the value 123 from myString. If i know the name myString and put it into a textbox1 then annother textbox2 shows me the value 123.
Tried something like this:
var textForUrl = TestClass.GetType().GetField(txtbox1.Text).GetValue(TestClass, null)
But not working, also, my variables are all located in a seperate .cs file.
>Solution :
To get field public static string myString = "123";
var textForUrl = typeof(TestClass).GetField("myString")?.GetValue(null);
To get property public static string { get; set; } myString = "123";
var textForUrl = typeof(TestClass).GetProperty("myString")?.GetValue(null);