Suzi167
September 12th, 2007, 10:09 AM
Hi I am using reflection and I need to get the properties out of my type
But I only want to get the properties that have both Get and Set Accessors.
How can I accomplish that using the BindingFlags enum?
Here is my code:
foreach (Type type in assembly.GetTypes())
{
foreach (PropertyInfo propInfo in type.GetProperties(BindingFlags.SetProperty | BindingFlags.GetProperty))
{
//do some stuff here.
}
}
This does not quite work. I need to go inside the second loop only if the specific Property has both Get and Set.
Thanks very much in advance
Susan
But I only want to get the properties that have both Get and Set Accessors.
How can I accomplish that using the BindingFlags enum?
Here is my code:
foreach (Type type in assembly.GetTypes())
{
foreach (PropertyInfo propInfo in type.GetProperties(BindingFlags.SetProperty | BindingFlags.GetProperty))
{
//do some stuff here.
}
}
This does not quite work. I need to go inside the second loop only if the specific Property has both Get and Set.
Thanks very much in advance
Susan