I've built a structure to handle writing of data to a file from any class or structure that implements my IObject interface (I'll come up with a better name later).
When I try to use GetType with it, as shown below, the syntax highlighter highlights GetType (line 5) and tells me it's not a member of IObject.
I'm using an interface instead of a MustInherit class because I have several structures which also implement IObject and several classes that inherit existing classes (such as Collection(of t)). Is there any way to get the type name from an interface?
I thought of using DirectCast to cast it to Object. Will that work if fromObject is a structure instead of a class?
vb Code:
Public Sub New(ByVal fromObject As IObject)
Me.Object = fromObject
Me.Data = fromObject.GetData
Me.ObjectType = ObjectTypes.Other
Me.OtherTypeName = fromObject.GetType.FullName
End Sub