Hi everyone, I guess this question applies to C# too. I am using the Assembly.GetTyp es() reflection method to build an object explorer for my project, and for the life of me I can't seem to figure out how to tell a regular class apart from a delegate in my query loop. Any ideas on how I could tell the difference?
It's probably not the hardest thing in the world, but it shows up my lack of current knowledge in reflection, so will be glad to hear from those more experienced in the area :)
---
Ok after a while of playing round I discovered that it's possible to query weather the type has the BaseClass type MulticastDelega te, so made this extension method:
And it seems to work, however as this is a new subject to me, I am fully aware that this maybe the wrong way to do it, anyone have any thoughts?
Aimee.
It's probably not the hardest thing in the world, but it shows up my lack of current knowledge in reflection, so will be glad to hear from those more experienced in the area :)
---
Ok after a while of playing round I discovered that it's possible to query weather the type has the BaseClass type MulticastDelega te, so made this extension method:
Code:
<Extension()>
Public Function IsDelegate(ByVal aType As Type) As Boolean
Return aType.BaseType Is GetType(MulticastDelegate)
End Function
Aimee.