【发布时间】:2011-10-24 01:42:13
【问题描述】:
出于某种原因,即使我在 Program.cs 中声明了一个静态和公共字符串,但当我在另一个类中引用它时,例如Class1.cs,没找到:
Program.cs
public static string fileName = "test.txt";
Class1.cs
XElement address = new XElement("PingResults",
new XElement("NameoFile", fileName),
new XElement("URL", test),
new XElement("Time", test2)
);
我也尝试过使用 Class1.fileName,但没有运气。有什么想法吗?
【问题讨论】: