C#文件名格式类似于Web地址

本文关键字:Web 地址 类似于 格式 文件名 | 更新日期: 2023-09-27 18:26:59

我有一个文件名,我无法更改。这是一个文件名看起来像"www.Test.somee.com"的示例

如果我尝试在Visual Studio中找到该文件名的路径,由于所有的句号,它将出错。

有什么方法可以让C#识别这是一个文件名而不是代码?

这就是我使用它的线路。

public partial class www.Test.somee.com_Website_Default : System.Web.UI.Page

我收到了这一行所有的错误。

Error   2   Invalid token '.' in class, struct, or interface member declaration     
Error   3   Invalid token ':' in class, struct, or interface member declaration     
Error   5   The namespace '<global namespace>' already contains a 
definition for 'www'    

C#文件名格式类似于Web地址

不能有这样的名称的页面,因为它是无效的。(这些错误就是这个意思)

如果你想要这样难看的名字,你必须用.代替另一个字符,例如_-

请参阅命名类的一般指南。

http://msdn.microsoft.com/en-us/library/ms229040%28v=vs.110%29.aspx