本文整理汇总了C#中dnlib.DotNet.TypeSig.RemoveModifiers方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSig.RemoveModifiers方法的具体用法?C# TypeSig.RemoveModifiers怎么用?C# TypeSig.RemoveModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnlib.DotNet.TypeSig
的用法示例。
在下文中一共展示了TypeSig.RemoveModifiers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNameByType
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;
}
示例2: FixTypeSig
TypeSig FixTypeSig(TypeSig type)
{
return SubstituteGenericParameter(type.RemoveModifiers()).RemoveModifiers();
}
示例3: GetNameByType
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;
}