is the given property an enum?

  • Thread starter Thread starter Adam J. Schaff
  • Start date Start date
A

Adam J. Schaff

I want to write a function that takes an Object and the name of a property
of that object and returns a boolean saying whether or not the given
property is an enum. So, the signature would be thus:

Public Function IsEnumProperty(byval someObject as Object, byval
nameOfPropertyOfThatObject as
String) As Boolean

If I admit that I'm hopelessly under-informed about reflection, would
someone be nice enough to provide some sample code or point me in the right
direction?

Any help is appreciated,
AJ
 
Adam,
If I admit that I'm hopelessly under-informed about reflection, would
someone be nice enough to provide some sample code or point me in the right
direction?

someObject.GetType().GetProperty("nameOfPropertyOfThatObject").PropertyType.IsEnum



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top