发布版本的自动属性合同 [英] Contracts on auto properties for Release version

查看:91
本文介绍了发布版本的自动属性合同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好!

为了减少详细程度,我想在我的课程中使用自动实现的属性。

For the decrease of verbosity, I'd like to use auto implemented properties in my classes.


public object ClassSomething
{
  get;
  protected set;
}

推荐答案

如果你在公共自动getter / setter上使用Invariant,他们会变成确定/要求那些getter / setter方法。因此,如果你选择"公共表面合同",它们应该出现。

If you use an Invariant on a public auto getter/setter, they turn into ensures/requires on those getter/setter methods. So if you pick "public surface contracts", they should show up.

如果你遇到麻烦,请告诉我们。

Let us know if you run into trouble with this.


这篇关于发布版本的自动属性合同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆