本文整理匯總了C#中System.Compiler.Method.GetUnmangledNameWithoutTypeParameters方法的典型用法代碼示例。如果您正苦於以下問題:C# Method.GetUnmangledNameWithoutTypeParameters方法的具體用法?C# Method.GetUnmangledNameWithoutTypeParameters怎麽用?C# Method.GetUnmangledNameWithoutTypeParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Compiler.Method
的用法示例。
在下文中一共展示了Method.GetUnmangledNameWithoutTypeParameters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetMethodName
internal static string GetMethodName(Method method, MemberNameOptions givenOptions, Scope scope, out bool isIndexer) {
string methName = null;
isIndexer = false;
if ( method.Template != null)
methName = MemberNameBuilder.GetAtPrefixedIfRequired(method.Template.GetUnmangledNameWithoutTypeParameters(true), givenOptions);
else
methName = MemberNameBuilder.GetAtPrefixedIfRequired(method.GetUnmangledNameWithoutTypeParameters(true), givenOptions);
if (method is InstanceInitializer) {
MemberNameOptions mask = MemberNameOptions.Keywords | MemberNameOptions.TemplateInfo | MemberNameOptions.TemplateArguments | MemberNameOptions.TemplateParameters | MemberNameOptions.Namespace | MemberNameOptions.EnclosingType;
methName = MemberNameBuilder.GetMemberNameRaw(method.DeclaringType, givenOptions & ~mask, scope);
} else if (method.IsSpecialName) {
if (methName.StartsWith("get_") || methName.StartsWith("set_")) {
if ((method.Parameters != null && method.Parameters.Count > 0)) {
// In this case enclosing type is not really an option. its part of name.
methName = MemberNameBuilder.GetMemberNameRaw(method.DeclaringType, givenOptions, scope);
if (methName == null)
methName = "";
isIndexer = true;
}
methName = methName.Substring(4);
} else if (methName.StartsWith("add_") && method.Parameters != null && method.Parameters.Count == 1)
methName = methName.Substring(4);
else if (methName.StartsWith("remove_") && method.Parameters != null && method.Parameters.Count == 1)
methName = methName.Substring(7);
else {
string opName = method.Name == null ? null : (string)Cci.Checker.OperatorName[method.Name.UniqueIdKey];
if (opName != null) {
// In this case Enclosing type is not really an option. its part of name.
string name = MemberNameBuilder.GetMemberNameRaw(method.DeclaringType, givenOptions, scope) + "." + opName;
if (method.Name.UniqueIdKey == StandardIds.opExplicit.UniqueIdKey || method.Name.UniqueIdKey == StandardIds.opImplicit.UniqueIdKey)
name = name + " " + MemberNameBuilder.GetMemberNameRaw(method.ReturnType, givenOptions, scope);
return name;
}
}
} else {
if (method.HasCompilerGeneratedSignature) {
if (method.Name.UniqueIdKey == StandardIds.Finalize.UniqueIdKey)
methName = "~" + MemberNameBuilder.GetAtPrefixedIfRequired(method.DeclaringType.Name.Name, givenOptions);
}
}
if (method.ImplementedTypes != null && method.ImplementedTypes.Count > 0 && method.ImplementedTypes[0] != null && IsOptionActive(givenOptions, MemberNameOptions.ImplementInterface))
methName = MemberNameBuilder.GetMemberNameRaw(method.ImplementedTypes[0], givenOptions, scope) + "." + methName;
if (IsOptionActive(givenOptions, MemberNameOptions.EnclosingType) && !isIndexer) {
string decTypeName = null;
if (!IsOptionActive(givenOptions, MemberNameOptions.SmartClassName) || !MemberNameBuilder.IsAggregateVisibleIn(method.DeclaringType, scope))
decTypeName = MemberNameBuilder.GetMemberNameRaw(method.DeclaringType, givenOptions, scope); ;
if (decTypeName != null)
methName = decTypeName + "." + methName;
}
return methName;
}
示例2: VisitMethodInternal
private Method VisitMethodInternal(Method method) {
if (method == null) return null;
this.writer.WriteStartElement("Method");
string nameWithParameters = method.GetUnmangledNameWithoutTypeParameters(false);
this.writer.WriteAttributeString("name", method.ReturnType.GetFullUnmangledNameWithTypeParameters() + " " +
nameWithParameters);
this.WriteSourceContext(method);
this.writer.WriteEndElement(); // Method
return method;
}