__FUNCTION__样式信息的宏 [英] macro for __FUNCTION__ style information

查看:73
本文介绍了__FUNCTION__样式信息的宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到在C#中没有宏也没有__FUNCTION__这样的东西,

我知道我可以这样做以获得当前的函数名称:


System.Reflection.MethodBase.GetCurrentMethod()。Na me


但是,它相当长。有没有办法制作像宏?

或简写来使用它?如果我做了一个功能,它就会失去

的目的。


thx


Zytan

I realize there are no macros and no such thing as __FUNCTION__ in C#,
and I know I can do this to get the current function name:

System.Reflection.MethodBase.GetCurrentMethod().Na me

But, it''s rather long. Is there a way to make something like a macro
or shorthand to use this? If I make a function, it defeats the
purpose.

thx

Zytan

推荐答案

Zytan写道:
Zytan wrote:

我发现没有宏,也没有这样的东西__FUNCTION__在C#中,

我知道我可以这样做以获得当前的函数名称:


System.Reflection.MethodBase.GetCurrentMethod()。Na me


但是,它相当长。有没有办法制作像宏?

或简写来使用它?如果我做了一个功能,它就会失去

的目的。


thx


Zytan
I realize there are no macros and no such thing as __FUNCTION__ in C#,
and I know I can do this to get the current function name:

System.Reflection.MethodBase.GetCurrentMethod().Na me

But, it''s rather long. Is there a way to make something like a macro
or shorthand to use this? If I make a function, it defeats the
purpose.

thx

Zytan



使用MB = System.Reflection.MethodBase;


命名空间NS

{

公共部分课程CLASS

{

public void MethodToName()

{

// ...

MB.GetCurrentMethod()。名称

// ...

}

}

}


我只能将事情简化为MethodBase的名字,抱歉。

using MB = System.Reflection.MethodBase;

namespace NS
{
public partial class CLASS
{
public void MethodToName()
{
// ...
MB.GetCurrentMethod().Name
// ...
}
}
}

I can only shorten things up to the MethodBase''s name, sorry.


2月23日2007 17:26:30 -0800,Zytan < zy ********** @ yahoo.comwrote:
On 23 Feb 2007 17:26:30 -0800, "Zytan" <zy**********@yahoo.comwrote:

>我意识到C#中没有宏,也没有__FUNCTION__这样的东西,
我知道我可以这样做以获取当前的函数名称:

System.Reflection.MethodBase.GetCurrentMethod()。N ame

但是,它's很长。有没有办法制作类似宏或简写的东西来使用它?如果我发挥作用,它就会失去
目的。


Zytan
>I realize there are no macros and no such thing as __FUNCTION__ in C#,
and I know I can do this to get the current function name:

System.Reflection.MethodBase.GetCurrentMethod().N ame

But, it''s rather long. Is there a way to make something like a macro
or shorthand to use this? If I make a function, it defeats the
purpose.

thx

Zytan



写一个VS 2k5宏,当你双击它时会为它打字吗?


祝你的项目好运,


Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
http://www.n5ge.com

Write a VS 2k5 macro that will type it in for you when you double click it?

Good luck with your project,

Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
http://www.n5ge.com


也许你可以写一个Visual Studio 2005 Code Snippet如果你找不到它 http://msdn2.microsoft.com/en-us/vstudio/aa718338.aspx


-

问候

盛江

Visual C ++中的Microsoft MVP

" Zytan" < zy ********** @ yahoo.comwrote in message

news:11 ******************** **@v33g2000cwv.googlegr oups.com ...
maybe you can write a Visual Studio 2005 Code Snippet if you can not find it
in http://msdn2.microsoft.com/en-us/vstudio/aa718338.aspx

--
Regards
Sheng Jiang
Microsoft MVP in Visual C++
"Zytan" <zy**********@yahoo.comwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...

>我意识到C#中没有宏,也没有__FUNCTION__这样的东西,

我知道我可以这样做以获得当前的函数名称:


System.Reflection.MethodBase.GetCurrentMethod()。Na me


但是,它相当长。有没有办法制作像宏?

或简写来使用它?如果我做了一个功能,它就会失去

的目的。


thx


Zytan
>I realize there are no macros and no such thing as __FUNCTION__ in C#,
and I know I can do this to get the current function name:

System.Reflection.MethodBase.GetCurrentMethod().Na me

But, it''s rather long. Is there a way to make something like a macro
or shorthand to use this? If I make a function, it defeats the
purpose.

thx

Zytan



这篇关于__FUNCTION__样式信息的宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆