0
Comment puis-je tester si un type de classe générique implémente une interface spécifique?Inspect Genric Type
échantillon:
Public Interface IBaseItemInterface(of Type)
...
End Interface
Public Interface ISpecificItemInterface(Of Type)
Inherits IBaseItemInterface(of Type)
...
End Interface
Public Interface IRootInterface(of Type, TEntity as IBaseItemInterface))
...
End Interface
'Implementation
Public Class Sample(of Type, TEntity as IBaseItemInterface))
Implements IRootInterface(of Type, TEntity)
Public Sub test()
**If TEntity Implements ISpecificItemInterface then**
DoSomethingSpecific
End if
End Sub
End Class
Comment cela peut-il être fait? Y a-t-il une autre façon de faire cela?
Merci beaucoup :) –