c# 4.0 - What do you think of the Managed Contract Tools library -


I have recently seen this video about the Managed Control Tools Library which certainly seems very interesting, unfortunately It seems that they will not include it in this language, which is more beautiful as the speck #. It would be good to have both options in C # 4.0, because contracts add too much noise to the business code.

Has anyone here been used and some real world response? Can you add contracts in class properties and even variables? Something like

  decimal percent (minimum 0, maximum 1) string non-string (faucet, rescox ("??"))  

.

I am trying, but I think the library is very serious so that it can be used seriously With large projects, at least stable check-up: The compilation is very slow and it is not very clear to read the specific warning.

Runtime can be used without checking problems, because they are being implemented as a debug. At least you methods of documents.

To add the contract for the properties I add the constraints in the set property, but in this specific case I think it would be better to write a class that can actually meet the requirements, only Good things to be allowed anyway:

  Percentage of personal decimals; Set decimal percentage {{return _Percentage;} {CodeContract.RequiresAlways (value & lt; = 1); CodeContract.RequiresAlways (value> = 0); _Percentage = value; }}  

p.s: I think the trend in C # goes in dynamic typing direction, instead of going to strict and strong typing coding methods. I think that works better with strong typing, at least because it lets you add more requirements for type and functions


Comments