S
Simon Woods
Hi
Still trying to get to grips with VB.Net so sorry if these seem silly
questions ...
I have an object which is implementing a secondary interface. I want to
get the name of the underlying object.
My Interface is:
Public Interface ICommand
Sub Execute
End Interface
ATM, I'm doing
name = DirectCast(myInterfacedObject, Object).GetType.Name
Are there better ways of doing this? Examples I've seen in C# seem to
suggest that you can call the GetType off the Interface itself.
Obviously I could put the Name property onto the interface, but I'm
wondering if there are some other ways I could do this?
Also, what is going on when DirectCast is called? Is the object being
copied to somewhere else in memory or is a different address in memory
being used to retrieve the Type info?
Thanks
Simon
Still trying to get to grips with VB.Net so sorry if these seem silly
questions ...
I have an object which is implementing a secondary interface. I want to
get the name of the underlying object.
My Interface is:
Public Interface ICommand
Sub Execute
End Interface
ATM, I'm doing
name = DirectCast(myInterfacedObject, Object).GetType.Name
Are there better ways of doing this? Examples I've seen in C# seem to
suggest that you can call the GetType off the Interface itself.
Obviously I could put the Name property onto the interface, but I'm
wondering if there are some other ways I could do this?
Also, what is going on when DirectCast is called? Is the object being
copied to somewhere else in memory or is a different address in memory
being used to retrieve the Type info?
Thanks
Simon