I’m trying to define a method in my vb.net interface that will only accept objects that inherit from the same interface and are also of the same class as the instance which receives the method call. Is this possible in vb.net?
Below I try to illustrate with a (invalid) generic type constraint what I wish to do:
Public Interface IFoo
CompareStuff(Of T as sametype)(obj as T) as Boolean
End Interface
Use like this:
but unfortunately also allows this to compile:
Can’t think of anything properly constraining right now.