0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

C#のプロパティ初期化とGetter,Setterの書き方

Last updated at Posted at 2020-07-22
samples.cs
//初期化
 public int Sum{ get; set; } = int.MinValue;
//Getter定義
 public int Sum2 =>  10 + int.MinValue;
 public string Str { get { return $"===={Sum2}===="; } set { } }
コード補完.cs
prop + tab
public int MyProperty { get; set; }

propg + tab
public int MyProperty { get; private set; }
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?