public MemberDescription(TypeDescription declaringType, ConstructorInfo constructor) { if (declaringType == null) { throw new ArgumentNullException("declaringType"); } if (constructor == null) { throw new ArgumentNullException("constructor"); } this.Name = constructor.Name; this.DeclaringType = declaringType; this.ResultType = declaringType; this.member = constructor; this.parameters = constructor.GetParameters(); this.parametersByName = this.parameters.ToDictionary(GetParameterName, StringComparer.Ordinal); this.returnParameter = null; this.hashCode = constructor.GetHashCode(); this.GenericArgumentsCount = constructor.IsGenericMethod ? constructor.GetGenericArguments().Length : 0; this.HasByRefLikeParameters = this.parameters.Any(parameter => TypeDescription.HasByRefLikeAttribute(parameter.ParameterType)); this.IsConstructor = true; this.IsStatic = constructor.IsStatic; }
public MemberDescription(TypeDescription declaringType, MethodInfo method, MemberDescription genericMethodDefinition = null) { if (declaringType == null) { throw new ArgumentNullException("declaringType"); } if (method == null) { throw new ArgumentNullException("method"); } this.Name = method.IsGenericMethod ? TypeNameUtils.RemoveGenericSuffix(method.Name) : method.Name; this.DeclaringType = declaringType; this.ResultType = method.ReturnType; this.member = method; this.parameters = method.GetParameters(); this.parametersByName = this.parameters.ToDictionary(GetParameterName, StringComparer.Ordinal); this.returnParameter = method.ReturnParameter; this.hashCode = method.GetHashCode(); if (method.IsGenericMethod) { this.GenericArguments = method.GetGenericArguments(); this.GenericArgumentsCount = this.GenericArguments.Length; if (method.IsGenericMethodDefinition) { this.methodInstantiations = new Dictionary <TypeTuple, MemberDescription>(); this.genericDefinition = this; } else { if (genericMethodDefinition == null) { throw new ArgumentNullException("genericMethodDefinition"); } this.methodInstantiations = genericMethodDefinition.methodInstantiations; this.genericDefinition = genericMethodDefinition; } } this.HasByRefLikeParameters = this.parameters.Any(parameter => TypeDescription.HasByRefLikeAttribute(parameter.ParameterType)); this.IsMethod = true; this.IsStatic = method.IsStatic; this.IsImplicitOperator = method.IsSpecialName && this.Name == "op_Implicit"; }