How does Contract.Exists add value?
Posted
by Scott Bilas
on Stack Overflow
See other posts from Stack Overflow
or by Scott Bilas
Published on 2010-05-06T21:45:31Z
Indexed on
2010/05/06
21:48 UTC
Read the original article
Hit count: 170
code-contracts
|c#
I am just starting to learn about the code contracts library that comes standard with VS2010. One thing I am running into right away is what some of the contract clauses really mean.
For example, how are these two statements different?
Contract.Requires(!mycollection.Any(a => a.ID == newID));
Contract.Requires(!Contract.Exists(mycollection, a => a.ID == newID));
In other words, what does Contract.Exists do in practical purposes, either for a developer using my function, or for the static code analysis system?
© Stack Overflow or respective owner