CompareCloudware.Web/FluentSecurity/Extensions.cs
/// <summary>
/// Returns true when the object is a match for the specified generic type
/// </summary>
/// <param name="obj">The object to compare</param>
/// <param name="genericType">The generic typet to compare object to</param>
/// <returns>A boolean</returns>
Returns true when the object is a match for the specified generic type
Returns true when the object is a match for the specified generic type
internal static bool IsMatchForGenericType(this object obj, Type genericType)
        {
            if (!genericType.IsGenericType) throw new ArgumentException("The specified type is not a generic type", "genericType");
            if (obj == null) return false;
            var type = obj.GetType();
            return type.IsGenericType && type.GetGenericTypeDefinition() == genericType;
        }
internal static bool IsMatchForGenericType ( this object obj , Type genericType ) { if ( ! genericType . IsGenericType ) throw new ArgumentException ( " " , " " ) ; if ( obj == null ) return false ; var type = obj . GetType ( ) ; return type . IsGenericType && type . GetGenericTypeDefinition ( ) == genericType ; }
Returns true when the object is a match for the specified generic type
Returns true when the object is a match for the specified generic type
None
object
this
genericType
Type
The generic typet to compare object to
The generic typet to compare object to
obj
The object to compare
The object to compare