如何使用代码片段获取方法的名称?在csharp [英] How to get the name of method using code snippet? in csharp
本文介绍了如何使用代码片段获取方法的名称?在csharp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我正在执行下面的代码片段代码(调试双击).........我有当前的类名,但方法名称不能获得?
为什么?
如果是worng代码请发送代码....如何获取当前方法名称?请
我需要healp
<? xml version = 1.0 encoding = utf-8 ? >
< CodeSnippets xmlns = http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet >
< Co deSnippet 格式 = 1.0.0 >
< 标题 >
< ; SnippetTypes >
< SnippetType > 扩展< / SnippetType >
< / SnippetTypes >
< 标题 > SnippetFile1 < / Title >
< 作者 > admin < /作者 >
< 说明 >
< / Description >
< HelpUrl >
< / HelpUrl >
< 快捷方式 > debug < / Shortcut >
< /标头 >
< 代码段 >
< 声明 >
< Literal 可编辑 = true >
< ID > AtParDebugLog < / ID >
< < span class =code-leadattribute>工具提示 >
< /工具提示 >
< 默认 >
< /默认 >
< ; 功能 >
< / Func >
< / Literal >
< Literal 可编辑 = false >
< ID > classname < / ID >
< 工具提示 > 类名< / ToolTip >
< 功能 > ClassName()< / Function >
< 默认 > ClassNamePlaceholder < /默认 >
< / Literal >
< < span class =code-leadattribute> Literal >
< ID > 方法< / ID >
< 工具提示 > 方法名称< /工具提示 >
< < span class =code-leadattribute>默认 > MethodNamePlaceholder < /默认 >
< < span class =code-leadattribute> / Literal >
< / D. eclarations >
< 代码 语言 = csharp 分隔符 = $ > <![CDATA [ if(log.IsDebugEnabled){log.Debug(ClassName:$ classname $
MethodName:$ method $()描述:); } ]]> < /代码 >
< / Snippet >
< / CodeSnippet >
< < span class =code-leadattribute> / CodeSnippets >
解决方案
> <![CDATA [ if(log.IsDebugEnabled){log.Debug(ClassName:
classname
方法名:
Hi I am executing the below code of code snippet (debug double tap).........I got current class name , but method name is not get?
why?
if it is worng code please send the code....How to get the current method name? please
I need healp
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Title>SnippetFile1</Title>
<Author>admin</Author>
<Description>
</Description>
<HelpUrl>
</HelpUrl>
<Shortcut>debug</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>AtParDebugLog</ID>
<ToolTip>
</ToolTip>
<Default>
</Default>
<Function>
</Function>
</Literal>
<Literal Editable="false">
<ID>classname</ID>
<ToolTip>Class name</ToolTip>
<Function>ClassName()</Function>
<Default>ClassNamePlaceholder</Default>
</Literal>
<Literal >
<ID>method</ID>
<ToolTip>Method name</ToolTip>
<Default>MethodNamePlaceholder</Default>
</Literal>
</Declarations>
<Code Language="csharp" Delimiter="$"><![CDATA[ if (log.IsDebugEnabled) { log.Debug("ClassName: $classname$
MethodName:$method$() Description: " ); }]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
解决方案
"><![CDATA[ if (log.IsDebugEnabled) { log.Debug("ClassName:
classname
MethodName:
这篇关于如何使用代码片段获取方法的名称?在csharp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文