のメソッド内でプロパティを使用する方法。私はインターネット上で検索していましたが、値が返されるメソッドの内部でプロパティが使用されていることがわかりません。正しい方法でメソッド内でプロパティを使用する方法の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」メソッドから値を取得するプロパティを使用したいと思い、それが正しい上記のコードですか?次の2つのパラメータを渡したが、その後、あなたの計算でそれらを無視しているので
[Msdn](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/using-properties)。 – Sinatr
「return this.ShiftTime - this.BreakTime;」だけを使用してください。あなたのパラメータ(シフト、ブレークタイム)の必要はありません。 – Flocke
"sift"と "breaktime"というローカル変数を使用することは関数ではありません。 –