internal static string TypeSigToString(Type pThis) { StringBuilder stringBuilder = new StringBuilder(); MetadataOnlyCommonType.TypeSigToString(pThis, stringBuilder); return(stringBuilder.ToString()); }
public override string ToString() { CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] str = new object[] { MetadataOnlyCommonType.TypeSigToString(this.ParameterType), this.Name }; return(string.Format(invariantCulture, "{0} {1}", str)); }
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); MetadataOnlyCommonType.TypeSigToString(this.ParameterType, stringBuilder); stringBuilder.Append(' '); return(stringBuilder.ToString()); }
internal static string CommonToString(MethodInfo m) { StringBuilder stringBuilder = new StringBuilder(); MetadataOnlyCommonType.TypeSigToString(m.ReturnType, stringBuilder); stringBuilder.Append(" "); MetadataOnlyMethodInfo.ConstructMethodString(m, stringBuilder); return(stringBuilder.ToString()); }
internal static void VerifyNotByRef(MetadataOnlyCommonType type) { if (type.IsByRef) { string str = string.Concat(type.Name, "&"); CultureInfo invariantCulture = CultureInfo.InvariantCulture; string cannotFindTypeInModule = MetadataStringTable.CannotFindTypeInModule; object[] objArray = new object[] { str, type.Resolver.ToString() }; throw new TypeLoadException(string.Format(invariantCulture, cannotFindTypeInModule, objArray)); } }
internal static Type[] GetAllInterfacesHelper(MetadataOnlyCommonType type) { HashSet <Type> types = new HashSet <Type>(); if (type.BaseType != null) { types.UnionWith(type.BaseType.GetInterfaces()); } foreach (Type interfacesOnType in type.Resolver.GetInterfacesOnType(type)) { if (types.Contains(interfacesOnType)) { continue; } types.Add(interfacesOnType); types.UnionWith(interfacesOnType.GetInterfaces()); } Type[] typeArray = new Type[types.Count]; types.CopyTo(typeArray); return(typeArray); }
private static void ConstructMethodString(MethodInfo m, StringBuilder sb) { sb.Append(m.Name); string str = ""; if (m.IsGenericMethod) { sb.Append("["); Type[] genericArguments = m.GetGenericArguments(); for (int i = 0; i < (int)genericArguments.Length; i++) { Type type = genericArguments[i]; sb.Append(str); MetadataOnlyCommonType.TypeSigToString(type, sb); str = ","; } sb.Append("]"); } sb.Append("("); MetadataOnlyMethodInfo.ConstructParameters(sb, m.GetParameters(), m.CallingConvention); sb.Append(")"); }
private static void ConstructParameters(StringBuilder sb, Type[] parameters, CallingConventions callingConvention) { string str = ""; for (int i = 0; i < (int)parameters.Length; i++) { Type type = parameters[i]; sb.Append(str); MetadataOnlyCommonType.TypeSigToString(type, sb); if (type.IsByRef) { StringBuilder length = sb; length.Length = length.Length - 1; sb.Append(" ByRef"); } str = ", "; } if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) { sb.Append(str); sb.Append("..."); } }
internal static PropertyInfo GetPropertyImplHelper(MetadataOnlyCommonType type, string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) { if (binder != null) { throw new NotSupportedException(); } if (modifiers != null && (int)modifiers.Length != 0) { throw new NotSupportedException(); } StringComparison stringComparison = SignatureUtil.GetStringComparison(bindingAttr); PropertyInfo[] properties = type.GetProperties(bindingAttr); for (int i = 0; i < (int)properties.Length; i++) { PropertyInfo propertyInfo = properties[i]; if (propertyInfo.Name.Equals(name, stringComparison) && (!(returnType != null) || propertyInfo.PropertyType.Equals(returnType)) && MetadataOnlyTypeDef.PropertyParamTypesMatch(propertyInfo, types)) { return(propertyInfo); } } return(null); }
public virtual MetadataOnlyCommonType CreateVectorType(MetadataOnlyCommonType elementType) { return(new MetadataOnlyVectorType(elementType)); }
public virtual MetadataOnlyCommonType CreatePointerType(MetadataOnlyCommonType type) { return(new MetadataOnlyModifiedType(type, "*")); }
public virtual MetadataOnlyCommonType CreateByRefType(MetadataOnlyCommonType type) { return(new MetadataOnlyModifiedType(type, "&")); }
public virtual MetadataOnlyCommonType CreateArrayType(MetadataOnlyCommonType elementType, int rank) { return(new MetadataOnlyArrayType(elementType, rank)); }
public MetadataOnlyArrayType(MetadataOnlyCommonType elementType, int rank) : base(elementType) { this.m_rank = rank; }
public MetadataOnlyCommonArrayType(MetadataOnlyCommonType elementType) { this.m_baseType = Helpers.Universe(elementType).GetTypeXFromName("System.Array"); this.m_elementType = elementType; }
public override string ToString() { return(string.Concat(MetadataOnlyCommonType.TypeSigToString(this.FieldType), " ", this.Name)); }
public MetadataOnlyModifiedType(MetadataOnlyCommonType type, string mod) { this.m_type = type; this.m_mod = mod; }
public MetadataOnlyVectorType(MetadataOnlyCommonType elementType) : base(elementType) { }