简体   繁体   English

VS2005 C#:是否有一种特殊的visual-studio方法来创建属性,还是可以只键入代码?

[英]VS2005 C#: is there a special visual-studio way to create properties or can the the code just be typed out?

在VS2005中使用C#,是否有特殊的方法可以在IDE中创建属性,还是可以只键入getter和setter?

在代码编辑器中,输入prop + Tab + Tab

Well, you can type the word prop and then hit tab twice for a code snippet. 好吧,您可以输入单词prop ,然后按两次tab键以获得一个代码段。 propg will generate a readonly property (only a getter). propg将生成一个只读属性(仅一个吸气剂)。

I think what you're after are code snippets, have a look here and here . 我认为您所追求的只是代码片段, 在这里这里 看看

There are also snippets besides prop for properties that you may save you time, see here for the list of built-in snippets . 除了属性的prop之外,还有一些片段可以节省您的时间, 请参阅此处以获取内置片段列表

There are built-in code snippets - try typing prop then pressing TAB twice. 有内置的代码段-尝试键入prop然后按两次TAB This will automatically generate the code for a property with a getter a setter, and let you tab between a couple of points to declare property name and type. 这将自动为带有getter和setter的属性生成代码,并让您在两点之间切换以声明属性名称和类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM