私が達成したいことをコード例で示すのが最善ですか?
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<>()
ますか?