怎么得不到自己想编译出的东西,求高手指点! 感激不尽!
代码1:public class BanJi
{
private int number;
private string director;
private string monitor;
private string year;
public int Number
{
get { return number; }
set { number = value; }
}
public string Director
{
get { return director; }
set { director = value; }
}
public string Monitor
{
get { return monitor; }
set { monitor = value; }
}
public string Year
{
get { return year; }
set { year = value; }
}
public BanJi(int number, string director, string monitor, string year)
{
Number = number;
Director = director;
Monitor = monitor;
Year = year;
}
public override string ToString()
{
return string.Format("Number:{0}\nDirectorn:{1}\nMonitor:{2}\nYear:{3}",Number,Director,Monitor,Year);
}
}
代码2:
using System;
public class xoxo
{
public static int x;//这句话有什么用
public static void Main()
{
BanJi b23 = new BanJi( 0, "", "", "");
b23.Number = 27;
b23.Director= "王毅";
b23.Monitor = "李峰";
b23.Year = "2011级";
Console.WriteLine(b23.ToString());
}
}
得到的却是:
求高手解。。