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


C# MethodDeclarationSyntax.GetLocation方法代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax.GetLocation方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDeclarationSyntax.GetLocation方法的具体用法?C# MethodDeclarationSyntax.GetLocation怎么用?C# MethodDeclarationSyntax.GetLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax的用法示例。


在下文中一共展示了MethodDeclarationSyntax.GetLocation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MissingRefitAttributeWarning

        public MissingRefitAttributeWarning(InterfaceDeclarationSyntax @interface, MethodDeclarationSyntax method)
            : base("RF001")
        {
            setLocation(method.GetLocation());

            InterfaceName = @interface.Identifier.Text;
            MethodName = method.Identifier.Text;

            Message = string.Format(
                "Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.",
                InterfaceName, MethodName);
        }
开发者ID:reicheltp,项目名称:refit,代码行数:12,代码来源:Diagnostics.cs

示例2:

 /// <summary>
 /// Récupère le nom complet du type de la méthode (avec paramètre de type éventuel).
 /// </summary>
 /// <param name="méthode">La méthode.</param>
 /// <param name="méthodeCorrespondante">La méthode correspondante.</param>
 /// <param name="modèleSémantique">Le modèle sémantique (pour simplifier les types).</param>
 /// <returns>Le nom complet de la méthode.</returns>
 private static string RécupérerNomType(MethodDeclarationSyntax méthode, IMethodSymbol méthodeCorrespondante, SemanticModel modèleSémantique) =>
     méthodeCorrespondante.ContainingType.ConstructedFrom
         .ToMinimalDisplayString(modèleSémantique, méthode.GetLocation().SourceSpan.Start)
         .Replace('<', '{').Replace('>', '}');
开发者ID:JabX,项目名称:controle-point-virgule,代码行数:11,代码来源:Partagé.cs

示例3: WriteDetectedMisuseAsyncUsageToTable

        internal void WriteDetectedMisuseAsyncUsageToTable(int type, Microsoft.CodeAnalysis.Document Document, MethodDeclarationSyntax node)
        {

                string resultfile = @"C:\Users\Semih\Desktop\MisuseTables\" + type + ".txt";
                string delimStr = "/";
                char[] delimiter = delimStr.ToCharArray();
                var location = node.GetLocation().GetLineSpan();
                var app = AppName.Replace("+", "/");

                var methodName= node.Modifiers.ToString()+ " "+ node.ReturnType.ToString()+ " "+ node.Identifier.ToString() + " "+ node.ParameterList.ToString();

                string filepathWithLineNumbers = "http://www.github.com/" + app + "/blob/" + commit + "/" +
                    Document.FilePath.Replace(@"\", @"/").Split(delimiter, 6)[5] + "#L" + (location.StartLinePosition.Line + 1) + "-" + (location.EndLinePosition.Line + 1);
                var row = String.Format(@"<tr><td>{0}</td><td><a href='{1}'>Link to Source Code</a></td> </tr>", methodName, filepathWithLineNumbers);

                using (StreamWriter sw = File.AppendText(resultfile))
                {
                    sw.WriteLine(row);
                }
        }
开发者ID:modulexcite,项目名称:CSharpAnalyzer,代码行数:20,代码来源:AsyncAnalysisResult.cs

示例4: WriteNodeToCallTrace

        public void WriteNodeToCallTrace(MethodDeclarationSyntax node, int n)
        {
            var path = node.SyntaxTree.FilePath;
            var start = node.GetLocation().GetLineSpan().StartLinePosition;

            string message = "";
            for (var i = 0; i < n; i++)
                message += " ";
            message += node.Identifier + " " + n + " @ " + path + ":" + start;
            Logs.CallTraceLog.Info(message);
        }
开发者ID:modulexcite,项目名称:CSharpAnalyzer,代码行数:11,代码来源:AsyncAnalysisResult.cs

示例5: MultipleRefitMethodSameNameWarning

        public MultipleRefitMethodSameNameWarning(InterfaceDeclarationSyntax @interface, MethodDeclarationSyntax method)
            : base("RF002")
        {
            setLocation(method.GetLocation());

            InterfaceName = @interface.Identifier.Text;
            MethodName = method.Identifier.Text;

            Message = string.Format(
                "Method {0}.{1} has been declared multiple times. Refit doesn't support overloading.",
                InterfaceName, MethodName);
        }
开发者ID:reicheltp,项目名称:refit,代码行数:12,代码来源:Diagnostics.cs


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