这是一个奇怪的问题,即使我旁边的高级程序员也很困惑.完整的问题是我的ToString()
方法被调用,我不知道或不知道这是我的代码
static void Main(string[] args)
{
Console.Out.WriteLine("Blank Constructor");
Form form = new Form(); <-- ToString() gets called on this line.
form.ToString();
Console.Read();
}
public Form()
{
FormName = "";
FormImageLocation = "";
FormDescription = "";
FormID = 0;
CreatedDate = DateTime.Now;
LastUpdate = DateTime.Now;
Fields = new List<Field>();
Packets = new List<Packet>(); <-- This line in the constructor
}
public override string ToString()
{
string returnString;
returnString = " Form Name: " + FormName + " Form Image …
Run Code Online (Sandbox Code Playgroud)