Ejemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="constructor">Custom attribute constructor</param>
 /// <param name="constructorArguments">Constructor arguments or null</param>
 /// <param name="namedArguments">Custom attribute named arguments (fields and properties) or null</param>
 /// <param name="isPseudoCustomAttribute">true if this custom attribute was not part of the #Blob but created from some other info</param>
 public DmdCustomAttributeData(DmdConstructorInfo constructor, IList <DmdCustomAttributeTypedArgument> constructorArguments, IList <DmdCustomAttributeNamedArgument> namedArguments, bool isPseudoCustomAttribute)
 {
     Constructor             = constructor ?? throw new ArgumentNullException(nameof(constructor));
     ConstructorArguments    = ReadOnlyCollectionHelpers.Create(constructorArguments);
     NamedArguments          = ReadOnlyCollectionHelpers.Create(namedArguments);
     IsPseudoCustomAttribute = isPseudoCustomAttribute;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="flags">Flags</param>
 /// <param name="genericParameterCount">Number of generic parameters</param>
 /// <param name="returnType">Return type</param>
 /// <param name="parameterTypes">Parameter types or null</param>
 /// <param name="varArgsParameterTypes">Var args parameter types or null</param>
 public DmdMethodSignature(DmdSignatureCallingConvention flags, int genericParameterCount, DmdType returnType, IList <DmdType> parameterTypes, IList <DmdType> varArgsParameterTypes)
 {
     if (genericParameterCount < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(genericParameterCount));
     }
     Flags = flags;
     GenericParameterCount      = genericParameterCount;
     ReturnType                 = returnType ?? throw new ArgumentNullException(nameof(returnType));
     this.parameterTypes        = ReadOnlyCollectionHelpers.Create(parameterTypes);
     this.varArgsParameterTypes = ReadOnlyCollectionHelpers.Create(varArgsParameterTypes);
 }
Ejemplo n.º 3
0
        static ReadOnlyCollection <DmdType> GetGenericArguments(DmdType type)
        {
            if (!type.IsMetadataReference)
            {
                return(type.GetGenericArguments());
            }

            var resolvedType = type.ResolveNoThrow();

            if ((object)resolvedType != null)
            {
                return(resolvedType.GetGenericArguments());
            }

            if (type is Impl.DmdGenericInstanceTypeRef)
            {
                return(type.GetGenericArguments());
            }
            return(ReadOnlyCollectionHelpers.Empty <DmdType>());
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets the security attributes
 /// </summary>
 /// <returns></returns>
 public virtual ReadOnlyCollection <DmdCustomAttributeData> GetSecurityAttributesData() => ReadOnlyCollectionHelpers.Empty <DmdCustomAttributeData>();