如何提取给定 IMethodMessage 的函数属性?

发布于 2024-12-09 05:12:58 字数 271 浏览 3 评论 0原文

我有一个正在调用的函数的 IMethodMessage 实例。我想找出该函数的函数属性列表。有什么办法可以做到这一点吗?我看到我可以从 IMethodMessage 实例中提取方法名称和类型名称,但我不太清楚如何获取函数属性。

例如,如果我有以下函数:

[Steve()] 
public void enterUsername(String username) 
{ 
    ... 
}

如何确定被调用的函数是否具有“Steve()”属性?

I've got an IMethodMessage instance for a function that's being called. I want to find out the list of function attributes for the function. Is there any way to do this? I see that I can extract method name and typename from the IMethodMessage instance, but I can't quite figure out how to get the function attributes.

For example, if I have the following function:

[Steve()] 
public void enterUsername(String username) 
{ 
    ... 
}

How can I find out if the function being called has the "Steve()" attribute?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光病人 2024-12-16 05:12:58

您可以使用 IMethodMessage。 MethodBase 属性,然后调用 GetCustomAttributes 获取方法的属性。

You can use the IMethodMessage.MethodBase property, then call GetCustomAttributes to get the attributes for the method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文