Horje
c# check if type implements interface Code Example
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<>)




Csharp

Related
how to change the color of your text in c# Code Example how to change the color of your text in c# Code Example
ksi Code Example ksi Code Example
unity reset rigidbody velocity Code Example unity reset rigidbody velocity Code Example
c# linq extension methods left join Code Example c# linq extension methods left join Code Example
unity call a function every x seconds Code Example unity call a function every x seconds Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13