Net.Bluewalk.DotNetUtils/Extensions/TypeExtensions.cs
/// <summary>
/// Checks if type implements given interface
/// </summary>
/// <typeparam name="TInterface"></typeparam>
/// <param name="type"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
Checks if type implements given interface
Checks if type implements given interface
public static bool Implements<TInterface>(this Type type) where TInterface : class
        {
            var interfaceType = typeof(TInterface);
            if (!interfaceType.IsInterface)
                throw new InvalidOperationException("Only interfaces can be implemented.");
            return (interfaceType.IsAssignableFrom(type));
        }
public static bool Implements < TInterface > ( this Type type ) where TInterface : class { var interfaceType = typeof ( TInterface ) ; if ( ! interfaceType . IsInterface ) throw new InvalidOperationException ( " " ) ; return ( interfaceType . IsAssignableFrom ( type ) ) ; }
Checks if type implements given interface
Checks if type implements given interface
None
None
Type
this
type
None
typeparam
None