我试着打电话myCar.FormatMe(),但没有表现出来.我不知道为什么.有什么建议?
using System;
namespace SimpleClasses
{
class Program
{
static void Main(string[] args)
{
Car myCar = new Car();
myCar.Make = "BMW";
myCar.FormatMe();
Console.ReadLine();
}
}
class Car
{
public string Make { get; set; }
public string FormatMe()
{
return string.Format("Make: {0}", this.Make);
}
}
}
Run Code Online (Sandbox Code Playgroud)
非常感谢.
tec*_*der 11
您的代码中没有输出
class Program
{
static void Main(string[] args)
{
Car myCar = new Car();
myCar.Make = "BMW";
Console.WriteLine(myCar.FormatMe());
}
}
class Car
{
public string Make { get; set; }
public string FormatMe()
{
return string.Format("Make: {0}", this.Make);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
218 次 |
| 最近记录: |