I have a class kinda like
Myclass
{
List<int> var1;
List<int> var2;
List<int> var3;
e.t.c
}
I also have class instance and some string in a method. I need to use this string as a type or variable name. For example, I have string “var2”. I want to use it in a way that will work like
var t = myclassinstance.var2
.
I tried to conver it using typeof but it wasn’t successful.
New contributor
Dog-programmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.