Hi all,
I wonder if one of you kind people would be able to point me in the right direction. I have a class with quite a few properties and I thought it would be quite useful to be able to iterate through the classes collections with a foreach loop and return information about each property (such as name, type etc) and its value . However, this is where I come unstuck as I can't find an out-of -box way to do this.
I guess I need a collection of properties, but I'm not sure how best to implement
it - can anyone advise
TIA
Martin.

Properties Collection
EricPaul
Assembly assembly = Assembly.GetExecutingAssembly();
foreach( Type type in assembly.GetTypes() )
{
Console.WriteLine( "Type found: {0}", type.Name );
foreach( PropertyInfo propertyInfo in type.GetProperties() )
{
Console.WriteLine( "Property: {0} ({1})", propertyInfo.Name, propertyInfo.PropertyType.Name );
}
Console.WriteLine( string.Empty );
}
AllanP
There are many tutorials online, just google for them.