[Mono-list] Retrieving the Properties of a class at runtime

Shawn Vose mono@programmerforrent.com
Thu, 30 Dec 2004 12:19:48 -0500


Joe,
    Yep that is the monkey I was looking for.


Many thanks,
Shawn Vose
Joe Audette wrote:

> Something like this should give an idea of how to get started
>  
>
> public static void WriteProperties(string AssemblyPath)
>
> {
>
> Assembly assembly = Assembly.LoadFrom(AssemblyPath);
>
> foreach(Type type in assembly.GetTypes())
>
> {
>
> foreach(PropertyInfo propertyInfo in type.GetProperties())
>
> {
>
> Console.WriteLine(propertyInfo.Name);
>
> }
>
> }
>
> }
>
> Best Regards,
>
> Joe
>
>
>
> */Shawn Vose <mono@programmerforrent.com>/* wrote:
>
>     Can someone direct me to documentation on how to iterate over only
>     the
>     properties in a class at runtime. I have a class that is nothing but
>     properties and instead of typing out
>     Console.WriteLine(someObject.someProperty) it would rather iterate
>     over
>     the available properties.
>
>     Ist this where System.Refelection comes into play?
>
>     _______________________________________________
>     Mono-list maillist - Mono-list@lists.ximian.com
>     http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
> joe_audette@yahoo.com
> http://www.joeaudette.com
> http://www.mojoportal.com