c#类文件名的最大长度是多少,它的长度是否有限? [英] What's the max length of a c# class file name,Is it has limited length?

查看:567
本文介绍了c#类文件名的最大长度是多少,它的长度是否有限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怀疑它的长度有限吗?一旦我命名了一个名为AutoCalculateFileInfoLengthLimit的文件,大约有30个图表。

I doubt whethe it has limited length? Once I named a file called AutoCalculateFileInfoLengthLimit, about 30 charts.

推荐答案

从技术上讲,没有一个 - CLI没有施加任何限制,C#也没有规范。

但是,在实践中,C#编译器确实对每个名称施加了511个字符的限制。

如果你声明511个字符的东西就没事了,512和你在一起会得到一个长标识符错误。
Technically, there isn''t one - the CLI does not impose any limit, neither does the C# specification.
However, in practice, the C# compiler does impose a limit of 511 characters per name.
If you declare something with 511 characters you are fine, 512 and you will get an "Identifier to long" error.


这篇关于c#类文件名的最大长度是多少,它的长度是否有限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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