如何创建在VS类设计器自动实现的属性 [英] How do I create auto-implemented properties in the VS class designer

查看:260
本文介绍了如何创建在VS类设计器自动实现的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是类的设计者在Visual Studio 2008中,当我属性添加到我的班,他们用一个空setter和抛出一个NotImplementedException一个getter创建。在属性窗口中有一个名为的选项自动实现的,它总是greye出来。有没有一种方式,以便在默认情况下新的属性将是自动实现的,或某种方式打开该选项可以更改此设置,所以我没有让我每次在一个新的属性添加时编辑代码?

I'm using the class designer in Visual Studio 2008 and when I add properties to my classes they are created with an empty setter and a getter that throws a NotImplementedException. In the properties window there's an option called "Auto-Implemented" which is always greye out. Is there a way to change the settings for this so by default new properties will be auto-implemented or some way to turn this option on so I don't have to keep editing the code each time I add in a new property?

推荐答案

据我所知,你不能。我在一年多前问这个在巴萨 - 我不认为任何事情发生了变化。基本上,我的理解是,这是直接(不通过一个可编辑的片段)来完成。

AFAIK, you can't. I asked this at Barcelona a year or so ago - I don't think anything has changed. Basically, as I understand it, this is done directly (not via an editable snippet).

这篇关于如何创建在VS类设计器自动实现的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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