我最好用一个代码示例来展示我想要完成的事情?
class SomeClass
{
public int SomeProperty;
public void SomeOperation()
{
Contract.Ensures( "SomeProperty's value has not changed." );
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// How can I write this post-condition?
}
};
(传递给的字符串Contract.Ensures()
当然只是真正的后置条件表达式的占位符。)
我怎样才能做到这一点?在这里有用吗Contract.OldValue<>()
?