08/08/16 12:23:08
>>335
ん?型パラとObjいらなくね?
class Class1 {
readonly Func<string> getName;
readonly Func<int> getID;
public Class1(Func<string> getName, Func<int> getID) {
this.getName = getName;
this.getID = getID;
}
public void Method() {
Console.WriteLine("Name = {0}, ID = {1}", getName(), getID());
}
}
で、Class1のインスタンスを作るときに
new Class1(() => obj.Name, () => obj.ID);
みたいな感じで。