“使用”作为typedef会导致CS1001 [英] `using` as typedef causes CS1001

查看:97
本文介绍了“使用”作为typedef会导致CS1001的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



What's wrong with

using T = int;

它会导致编译器错误需要CS 1001标识符

推荐答案

您必须编写

using T = System.Int32;

因为 int 只是 System.Int32 ,并且这些速记未在语言规范中实现(例如,根据 c, int 不是标识符眼镜)。您需要输入完整的合格名称。

because int is just a shorthand for System.Int32, and those shorthands are not implemented in the language specification (i.e., int is not an identifier according to the specs). You need to give the full qualified name.

这篇关于“使用”作为typedef会导致CS1001的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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