相关疑难解决方法(0)

当单步执行我的程序时,无缘无故地调用ToString()方法

这是一个奇怪的问题,即使我旁边的高级程序员也很困惑.完整的问题是我的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)

c# debugging tostring visual-studio-2010

2
推荐指数
1
解决办法
480
查看次数

标签 统计

c# ×1

debugging ×1

tostring ×1

visual-studio-2010 ×1