How to make a simple Property

What key strokes do I use to make a simple Read-Write property without having to have the member variable already made.

Currently I use ALT+INS, but have to have the member variable already.

5 comments
Comment actions Permalink

Hello ianvink,

I think you have to build Live Template for this purpose.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


i> What key strokes do I use to make a simple Read-Write property
i> without having to have the member variable already made.
i>
i> Currently I use ALT+INS, but have to have the member variable
i> already.
i>


0
Comment actions Permalink

Doesn't sound intuitive to me. Ive run also into this and was mistified why
the field shoul be there first. Why can't resharper create it for us?


0
Comment actions Permalink

"Tom Pester" <omegafantaDODELETETTHIS@telenet.be> schrieb

Doesn't sound intuitive to me. Ive run also into this and was mistified
why the field shoul be there first. Why can't resharper create it for us?


It's an other way that R# uses. You didn't type more than in the plain
VS2005 with prop TAB TAB. And it's faster than VS when you have to define
more than one, and same speed if you have only one.

You allways have to type the the field-type and name of the field.

--
Regards

Albert Weinert
MVP Visual Developer ASP.NET

http://der-albert.com


0
Comment actions Permalink

It's an other way that R# uses. You didn't type more than in the plain
VS2005 with prop TAB TAB. And it's faster than VS when you have to
define more than one, and same speed if you have only one.


I never knew about "prop TAB TAB". Is that a VS.NET snippet or something
from R#?

I made a "p" template for private fields and a "P" template for public properties.

// "p" template text
private $Type$ _$FieldName$;

// "P" template text
private $Type$ _$FieldName$;

public $Type$ $FieldName$
{
get{ return _$FieldName$; }
set{ _$FieldName$ = value; }
}


0
Comment actions Permalink

"flipdoubt" <flipdoubt@nospam.com> schrieb im Newsbeitrag
news:da27a8e45ea458c987ae98eff5ec@news.jetbrains.com...

I never knew about "prop TAB TAB". Is that a VS.NET snippet or something
from R#?


CodeSnippet from VS (don't work if R# Intellisens is used)

// "p" template text
private $Type$ _$FieldName$;


don't make really sense, 'cause if you type

string name;

the R# automaticly sets "private" before the type name ;)

--
Regards

Albert Weinert
MVP Visual Developer ASP.NET

http://der-albert.com

0

Please sign in to leave a comment.