public static IMethod GetMethod(ITypeResolver typeResolver, IType declaringType, System.Reflection.MethodInfo methodInfo) { IMethod method; if (methodInfo == null) { throw new ArgumentNullException("methodInfo"); } IMutableMembers mutableMember = (IMutableMembers)declaringType; string nameWithParameters = PlatformTypeHelper.GetNameWithParameters(methodInfo); IMemberId member = mutableMember.GetMember(Microsoft.Expression.DesignModel.Metadata.MemberType.Method, nameWithParameters); if (member == null) { method = new Method(typeResolver, declaringType, methodInfo, nameWithParameters); mutableMember.AddMember(method); } else { method = Member.GetMemberAs <Method>(member); } return(method); }
public static IList <IConstructor> GetConstructors(ITypeResolver typeResolver, IType typeId) { Type runtimeType = typeId.RuntimeType; List <IConstructor> list = (List <IConstructor>)null; if (runtimeType != (Type)null) { ConstructorInfo[] constructors = PlatformTypeHelper.GetConstructors(runtimeType); if (constructors != null && constructors.Length > 0) { foreach (ConstructorInfo constructorInfo in constructors) { if (PlatformTypeHelper.IsAccessibleConstructor(constructorInfo)) { if (list == null) { list = new List <IConstructor>(constructors.Length); } list.Add((IConstructor) new Constructor(typeResolver, typeId, constructorInfo, PlatformTypeHelper.GetNameWithParameters((MethodBase)constructorInfo))); } } } } if (list != null) { return((IList <IConstructor>) new ReadOnlyCollection <IConstructor>((IList <IConstructor>)list)); } return((IList <IConstructor>)ReadOnlyCollections <IConstructor> .Empty); }