Search code examples
c#code-contracts

How to specify Requires for out parameter?


Related to this question: How to specify Ensures for out parameter?

How can I do this for the Ensures.Requires()-method?


Solution

  • In my case, I used the out-keyword incorrectly. As Matthew Watson said, I have to use ref-parameter.

    So I have no more problems with Contract.Requires().