/// <summary> /// Allocates a reference to a method. /// </summary> /// <param name="host">Provides a standard abstraction over the applications that host components that provide or consume objects from the metadata model.</param> /// <param name="containingType">A reference to the containing type of the referenced method.</param> /// <param name="callingConvention">The calling convention of the referenced method.</param> /// <param name="returnType">The return type of the referenced method.</param> /// <param name="name">The name of the referenced method.</param> /// <param name="genericParameterCount">The number of generic parameters of the referenced method. Zero if the referenced method is not generic.</param> /// <param name="parameters">Information about the parameters forming part of the signature of the referenced method.</param> /// <param name="extraParameterTypes">Reference to the types of the the extra arguments supplied by the method call that uses this reference.</param> public MethodReference(IMetadataHost host, ITypeReference containingType, CallingConvention callingConvention, ITypeReference returnType, IName name, ushort genericParameterCount, IEnumerable <IParameterTypeInformation> parameters, params ITypeReference[] extraParameterTypes) { this.host = host; _containingType = containingType; _callingConvention = callingConvention; _type = returnType; _name = name; _genericParameterCount = genericParameterCount; _parameters = parameters; _parameterCount = (ushort)IteratorHelper.EnumerableCount(parameters); List <IParameterTypeInformation> extraParameters = new List <IParameterTypeInformation>(extraParameterTypes.Length); for (ushort i = 0; i < extraParameterTypes.Length; i++) { extraParameters.Add(new SimpleParameterTypeInformation(this, i, extraParameterTypes[i])); } _extraParameters = extraParameters.AsReadOnly(); }
/// <summary> /// Creation helper from IEnumerable{T} /// </summary> public static ReadOnlyList <T> Create(IEnumerable <T> list) { return(Create(IteratorHelper.EnumerableCount <T>(list))); }