How can I use a string variable to get the properties associated with a given class? If I use the class name as in the following:-
PropertyInfo[] propertyInfo = typeof(Treblet).GetProperties();
where Treblet is the class name then I can get the number of properties for the class. But how can I replace the name of the class with a string variable? Thanks for all and any help.
This should do the trick. You will need to search the assembly that the type is defined in. For simplicity I’ve just searched the executing assembly.
Note Name is just the name of the type and FullName is the name of the type fully namespaced.