StringBuilder GetName(IType type) { this.transform.stringBuilder.Clear(); if (type == null) { return(this.transform.stringBuilder); } return(FullNameCreator.NameSB(type, false, this.transform.stringBuilder)); }
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); }