/// <summary> /// Removes all modifiers and pinned sig /// </summary> /// <param name="a">The type</param> /// <returns>Inputer after modifiers and pinned signature</returns> public static TypeSig RemovePinnedAndModifiers(this TypeSig a) { a = a.RemoveModifiers(); a = a.RemovePinned(); a = a.RemoveModifiers(); return(a); }
TypeSig FixTypeSig(TypeSig type) { return SubstituteGenericParameter(type.RemoveModifiers()).RemoveModifiers(); }
TypeSig FixTypeSig(TypeSig type) { return(SubstituteGenericParameter(type.RemoveModifiers()).RemoveModifiers()); }
string GetNameByType(TypeSig type) { type = type.RemoveModifiers(); GenericInstSig git = type as GenericInstSig; if (git != null && git.GenericType != null && git.GenericType.FullName == "System.Nullable`1" && git.GenericArguments.Count == 1) { type = ((GenericInstSig)type).GenericArguments[0]; } string name; if (type == null) return string.Empty; if (type.IsSingleOrMultiDimensionalArray) { name = "array"; } else if (type.IsPointer || type.IsByRef) { name = "ptr"; } else if (type.TypeName.EndsWith("Exception", StringComparison.Ordinal)) { name = "ex"; } else if (!typeNameToVariableNameDict.TryGetValue(type.FullName, out name)) { name = type.TypeName; // remove the 'I' for interfaces if (name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2])) name = name.Substring(1); name = CleanUpVariableName(name); } return name; }
string GetNameByType(TypeSig type) { type = type.RemoveModifiers(); GenericInstSig git = type as GenericInstSig; if (git != null && git.GenericType != null && git.GenericArguments.Count == 1 && git.GenericType.TypeDefOrRef.Compare(systemString, nullableString)) { type = ((GenericInstSig)type).GenericArguments[0]; } string name; if (type == null) return string.Empty; if (type.IsSingleOrMultiDimensionalArray) { name = "array"; } else if (type.IsPointer || type.IsByRef) { name = "ptr"; } else { stringBuilder.Clear(); if (FullNameCreator.NameSB(type, false, stringBuilder).EndsWith("Exception")) { name = "ex"; } else { stringBuilder.Clear(); if (!typeNameToVariableNameDict.TryGetValue(FullNameCreator.FullName(type, false, null, null, null, stringBuilder), out name)) { stringBuilder.Clear(); name = FullNameCreator.Name(type, false, stringBuilder); // remove the 'I' for interfaces if (name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2])) name = name.Substring(1); name = CleanUpVariableName(name); } } } return name; }