Mike Barnett - Getting started with Code Contracts in Visual Studio 2008
- Posted: Feb 23, 2009 at 2:40 PM
- 59,318 Views
- 11 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
The Research in Software Engineering team (RiSE) coordinates Microsoft's research in Software Engineering in Redmond, USA.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
There are several reasons to put the contracts into the code as opposed to using custom attributes. hillr's reply is definitely one of the big reasons. You can see our comments on this topic in our FAQ: http://msdn.microsoft.com/en-us/devlabs/dd492004.aspx.
Question I have is can the preconditions only go in the constructor? It makes sense to me that this would be the case, but I figued I'd ask just in case. I have a custom attribute where I need to check if a variable object inplements a specific interface, but the object is passed in a method and not in the constructor.
Thanks,
DoN
Thanks!
Thank you for the demonstration, I have put aside all my free time to try this out.
the static check in perticular is really cool
is there a way to customise the runtime checks a little more though? [i just watched the video so this might be obvious in practice]
Ensuring that your class is in a correct state would extremely cut back on how often you have to validate your code.
I'm going to start using this right away.
Does anyone know if I can use this with Windows Mobile development in Visual Studio?
--edit--
oh wait, there is one for pro as well
(use the second link, not the devlabs one)
Remove this comment
Remove this thread
close