/// <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; }
/// <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); }
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>()); }
/// <summary> /// Gets the security attributes /// </summary> /// <returns></returns> public virtual ReadOnlyCollection <DmdCustomAttributeData> GetSecurityAttributesData() => ReadOnlyCollectionHelpers.Empty <DmdCustomAttributeData>();