Code_1(これらのコードの両方が同じ結果を持って、なぜこのコードは、 "=>" を用いている)C#で "get {}"、 "set {}"または "=>"の構文を使用するときに違いはありますか?
public class Infor<TFirst, TSecond, TThird>
{
private TFirst first;
private TSecond second;
private TThird third;
public TThird Third { get => third; set => third = value; }
public TSecond Second { get => second; set => second = value; }
public TFirst First { get => first; set => first = value; }
}
Code_2(このコードは "=>" "を返す" ではない使用している)
public class Infor<TFirst, TSecond, TThird>
{
private TFirst first;
private TSecond second;
private TThird third;
public TThird Third { get { return third; } set { third = value; } }
public TSecond Second { get { return second; } set { second = value; } }
public TFrist First { get { return first; } set { first = value; } }
}
これらは意味的に同一です。ちょうど異なる記法。 – JLRishe
ここに、ドキュメントへのリンクがあります:[get(C#Reference)](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/get) – Marius
それはあなたの質問に答えるでしょう。 – CodingYoshi