Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
渡された引数が null の場合、ArgumentNullException は例外をスローします。これは実行時に発生します。Contract.Requiresは何をしますか? コンパイル時のチェックですか、それとも実行時にチェックされますか?
Contract.Requiresランタイム チェックです (ランタイム チェックはコンパイル時に自動的に生成されます。ドキュメントの 6.2 章と 7 章を参照してください)。実行できる特定の静的チェックもあります (ドキュメントの第 6.6 章を参照) が、これRequiresはランタイム チェックです。
Contract.Requires
Requires
スローする例外を指定できる一般的なオーバーロードがあることに注意してください (ArgumentNullException など)。