当前位置: 首页>>代码示例>>C#>>正文


C# Method.GetUnmangledNameWithoutTypeParameters方法代码示例

本文整理汇总了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;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:51,代码来源:Error.cs

示例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;
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:11,代码来源:SourceContextWriter.cs


注:本文中的System.Compiler.Method.GetUnmangledNameWithoutTypeParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。