J
jason
hello everyone,
is there any way in C# to perform dynamic property discovery? i know
such a thing was possible in C++ template code, but it was kind of an
ugly mess. i'm just curious if there is a way to do such a thing in C#,
not suggesting that C# should be able to do things that C++ did (no
need to start any wars here)
for example, if i have:
public class MyClass
{
MyClass() { }
public int P1;
public string P2;
}
can i somehow discover these properties at runtime? such as:
MyClass obj = new MyClass();
// #discovery psuedo-code:
// for each property in obj do
Console.WriteLine(Convert.ToString(/*property*/));
thanks for any help!
jason
is there any way in C# to perform dynamic property discovery? i know
such a thing was possible in C++ template code, but it was kind of an
ugly mess. i'm just curious if there is a way to do such a thing in C#,
not suggesting that C# should be able to do things that C++ did (no
need to start any wars here)
for example, if i have:
public class MyClass
{
MyClass() { }
public int P1;
public string P2;
}
can i somehow discover these properties at runtime? such as:
MyClass obj = new MyClass();
// #discovery psuedo-code:
// for each property in obj do
Console.WriteLine(Convert.ToString(/*property*/));
thanks for any help!
jason