我得到了这个代码
static Dictionary<string, XElement> DName = new Dictionary<string, string> { };
static void Main(string[] args)
{
DName.Add("RO","FL");
}
static void anotherMethod(){
Console.WriteLine(DName["RO"]);
//not working, while in Main works.
}
那么如何从其他方法访问它呢?