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;}}}
↧
ラムダ式プロパティは結果をキャッシュしない
↧