Do invariant assertions fit into C# programming?

Posted by P.Brian.Mackey on Stack Overflow See other posts from Stack Overflow or by P.Brian.Mackey
Published on 2011-01-03T15:23:08Z Indexed on 2011/01/03 16:54 UTC
Read the original article Hit count: 245

Filed under:
|
|
|
|

In the book coders at work, the author asks "How do you use invariants in your code". Please explain what this question means.

I saw class invariants on wiki, but the example is in Java and I am not skilled enough in Java to relate this example to C#. .NET 4.0 introduces invariance, covariance, and contravariance and is well explained here. Invariance is so broad. The authors usage of the word seems unit test related. For those that read the book, what does the author mean? Are we talking about making an assumption and simply testing the validity after the unit test?

© Stack Overflow or respective owner

Related posts about c#

Related posts about java