UfcppSample icon indicating copy to clipboard operation
UfcppSample copied to clipboard

field キーワード

Open ufcpp opened this issue 1 year ago • 3 comments
trafficstars

https://ufcpp.net/study/csharp/oo_property.html#auto 近辺に。

用語「自動プロパティ」

元々は「半自動プロパティ」って呼ばれてたけども、 最終的には「自動プロパティ」で統一したっぽい?

field キーワードでバッキングフィールドができる。 get;get => field; の省略形で、 set;set => field = value; の省略形。

↑これを全部「自動プロパティ」呼び。

キーワード

fieldvalue はキーワード扱いになった。 けど、nameof(value) (filed も?)だけは特別に認めるっぽい。

[SomeAttribute(nameof(value))] set => ... は行けるけど、プロパティ自体の属性では不可?

ufcpp avatar May 29 '24 14:05 ufcpp

ピタゴラスイッチ的に C# 13 入りする features。 https://github.com/ufcpp-live/UfcppLiveAgenda/issues/90#issuecomment-2132224601

ufcpp avatar May 29 '24 15:05 ufcpp

.NET 9 GA 時点で「LangVersion preview」で入るっぽい雰囲気。

ufcpp avatar Sep 02 '24 10:09 ufcpp

一応 VS 17.12p3 に merge されてるらしい。 LangVersion preview は外れない予定。

ufcpp avatar Oct 04 '24 13:10 ufcpp

https://ufcpp.net/study/csharp/cheatsheet/ap_ver14/#field-keyword https://ufcpp.net/study/csharp/oo_property.html?p=2#field-keyword

ufcpp avatar Sep 20 '25 13:09 ufcpp