我想知道如果我能得到物体称为静态类的静态方法 例如:嵌套静态类C#
public class Person
{
private static class TelephoneLine
{
public static string sharedString = string.Empty;
public static void NotifyOnCall()
{
//notify if someone call this person
}
public static void Comunicate(Person comunicateWith, string message)
{
sharedString = "Sender: " /* Object which called that method */ + " To: " + comunicateWith.Name +
" said: " + message;
}
}
public Person(string name)
{
Name = name;
}
string Name;
public void CallTo(Person person, string message)
{
TelephoneLine.Comunicate(person, message);
}
public void ShowCall()
{
Console.Write(TelephoneLine.sharedString);
}
}
}
那么,有没有可能获得“发件人”只是路过它在ThelephoneLine.Comunicate(this,comunicateWith,msg)的参数中?
如何关系到(嵌套)静态类这个问题:
事实上,TelephoneLine对象应该被别的东西所拥有? – CodesInChaos 2011-06-09 14:32:18