如何在正确的方式使用属性里面的方法。我在互联网上搜索,但我找不到属性是使用里面的方法,将返回值。如何在C#中使用属性里面的方法
public class OET
{
public int ShiftTime { get; set; }
public int BreakTime { get; set; }
public int DownTime { get; set; }
public int ProductionTarget { get; set; }
public int IdealRunRate { get; set; }
public int PrductionOneShift { get; set; }
public int RejectedProduct { get; set; }
public int planedProductionTime(int shift, int breaktime) {
shift = ShiftTime;
breaktime = BreakTime;
return shift - breaktime;
}
我想使用属性从“PlanedProductionTIme”方法获取价值,它是代码右上方?
[:资源下载](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/using-properties)。 – Sinatr
只需使用“return this.ShiftTime - this.BreakTime;”不需要您的参数(班次,休息时间)。 – Flocke
没有使用“筛选”和“breaktime”局部变量的功能。 –