static void Main(string[] args)
{
Person p1 = new Person();
p1.Age = 52;
p1.Height = 180;
p1.MyHeight();
p1.MyAge();
Console.ReadKey();
}
class Person
{
public int Height;
public int Age; public void MyHeight()
{
Console.WriteLine("我的身高是:{0}", this.Height);
}
public void MyAge()
{
Console.WriteLine("我的年龄是:{0]", this.Age);//错误出现在这里为什么?
}
}
{
Person p1 = new Person();
p1.Age = 52;
p1.Height = 180;
p1.MyHeight();
p1.MyAge();
Console.ReadKey();
}
class Person
{
public int Height;
public int Age; public void MyHeight()
{
Console.WriteLine("我的身高是:{0}", this.Height);
}
public void MyAge()
{
Console.WriteLine("我的年龄是:{0]", this.Age);//错误出现在这里为什么?
}
}
Console.WriteLine("我的年龄是:{0]", this.Age);//错误出现在这里为什么?粗心的楼主Console.WriteLine("我的年龄是:{0}", this.Age);//错误出现在这里为什么?