c# check if type implements interface
typeof(IMyInterface).IsAssignableFrom(typeof(MyType))
// or
typeof(MyType).GetInterfaces().Contains(typeof(IMyInterface))
// or for a generic interface, it’s a bit different:
typeof(MyType).GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMyInterface<>)
Also in C#:
- c# check if type implements interface
- c# object clone
- c# webrequest cookies
- 2d object look at object
- Oculus Go virtual mapping
- c# string to character array
- variables
- unity persistent data
- C# get all child classes of a class
- iteration c#
- ecs get specific entities with component
- c# console delay
- c# join string array
- c# checksum
- how to redirect to extern page in .net core
- c# string formatting
- vb.net check if datatable has rows
- how to trim path in C#
- how to update modal class using dbfirst in asp.net core
- print line in python
- populate combobox from array c#
- c# serialize
- c# type of generic is string