在c#中的方法参数中使用'class'关键字作为/ [英] using the 'class' keyword as/in a method argument in c#

查看:505
本文介绍了在c#中的方法参数中使用'class'关键字作为/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我在哪里看到这个,我肯定没有得到的语法通过编译器。
是否可以使用'class'C#关键字作为方法参数签名的一部分?

I'm not sure where I saw this, and I'm certainly not getting the syntax past the compiler. Is it possible to use the 'class' C# keyword as part of a method parameter signature?

foo(string x,class y)
{
}

foo(string x, class y) { }

任何人都看到这样的内容吗?
谢谢,
-gene

Anyone else see something like this? thanks, -gene

推荐答案

看起来你试图指定一个可以有任何类型的参数,在这种情况下你应该使用对象,因为一切都源于它。

Should you be using object maybe? It looks like you are trying to specify a parameter that can have any type, in which case you should use object, since everything derives from it.

这篇关于在c#中的方法参数中使用'class'关键字作为/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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