示例#1
0
 public override bool IsMatch(Type type, OpenTypeMatchContext context)
 {
     if (type == null)
     {
         throw new ArgumentNullException(nameof(type));
     }
     if (type.IsByRef)
     {
         var elementType = type.GetElementType();
         return(_inner.IsMatch(elementType, context));
     }
     return(false);
 }
示例#2
0
            public override bool IsMatch(Type type, OpenTypeMatchContext context)
            {
                if (type == null)
                {
                    throw new ArgumentNullException(nameof(type));
                }
                if (context == null)
                {
                    throw new ArgumentNullException(nameof(context));
                }

                if (type.IsGenericType &&
                    ExactMatch.TypeEquals(type.GetGenericTypeDefinition(), _outerType))
                {
                    var args = type.GetGenericArguments();

                    return(_inner.IsMatch(args[0], context));
                }

                return(false);
            }