C¶
Delegate¶
.NETのデリゲートはメソッドシグネチャと戻り値の型を表す型.- 次の例では
MyDelegateという名前のデリゲートを宣言DateTimeをパラメータとして整数を返す
1 | |
- 一致するシグネチャと戻り値の型に基づいてデリゲートにメソッドを割り当てる
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
- デリゲートにインライン匿名メソッドを割り当てる
1 2 3 4 5 | |
GUID¶
1 2 | |
インターフェースに対するNotImplementedException¶
- 実装しないメソッドに対して
throw new NotImplementedException();をつける - インターフェースに標準実装をつけておいてもよい
インターフェースの利用・階層¶
2023-01-23, .NET6¶
- https://enterprisecraftsmanship.com/posts/which-collection-interface-to-use/
- Use the most generic types possible for arguments,
IEnumerable<T>. - Use the most specific types possible for return values,
IReadOnlyList<T>