Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9366

ラムダ式プロパティは結果をキャッシュしない

$
0
0
usingSystem;namespaceSampleLambdaProperty{classProgram{staticvoidMain(string[]args){Console.WriteLine("Hello World!");varv=newSample();varu=v.Property;// 二度目は何も変わっていないが,メソッドは再び呼ばれている.varu2=v.Property;}}classSample{publicintProperty=>GetValue();privateintGetValue(){Console.WriteLine("Method Called!");return2;}}}

Viewing all articles
Browse latest Browse all 9366

Latest Images

Trending Articles