Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Created February 11, 2015 10:18
Show Gist options
  • Save ufcpp/35fa88a73f917715bccf to your computer and use it in GitHub Desktop.
Save ufcpp/35fa88a73f917715bccf to your computer and use it in GitHub Desktop.
Code Contracts in .NET 4
public int Insert(T item, int index)
{
Contract.Requires(index >= 0 && index <= Count);
Contract.Ensures(Contract.Result<int>() >= 0 && Contract.Result<int>() < Count);
return InsertCore(item, index);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment