Is there a way to create an auto property via code snippet using ReSharper? Like the prop for VS?
A:
Yes. You can setup any snippet you wish. These are called "Live Templates" in Resharper, and have a lot more functionality than the VS versions. Just choose "Resharper->Live Templates.." in VS to edit them.
Reed Copsey
2010-02-18 19:57:56
+2
A:
You can create a Live Template
Just go to the Resharper menu, and choos Live Templates. Click the little green + icon and add this:
public $type$ $name$ { get; set; }
Then give the wanted shortcut, and you are good to go.
Luhmann
2010-02-18 19:59:01
+3
A:
Resharper 5 has a prop snippet which goes to auto-property. Does 4.5 not?
pdr
2010-02-18 20:00:50
It absolutely does. Generate Property allows the user to select which form, autoprop, prop with backing field or "throw new NotImplementedException()".
Peter Lillevold
2010-02-18 20:03:47
but how do I do this via keyboard with R#?
CoffeeAddict
2010-02-18 20:04:31
I know about Alt + Ins, is that what you're talking about? But I can't get to properties if I have no backing fields defined in that context menu.
CoffeeAddict
2010-02-18 20:05:56
@coffeeaddict: Just put your cursor where you want the property and type prop<Tab> (you can probably get away with just typing pr<Tab>)
pdr
2010-02-18 20:08:05
I see no prop snippet when I do a Ctrl + J in 4.5
CoffeeAddict
2010-02-18 20:08:39
lol, I guess I was thinking the prop was the VS prop. duh, it does give you an automatic property. It must be using R#?
CoffeeAddict
2010-02-18 20:09:41
I'll be honest, I'm never sure which app is doing what, it's been so long since I worked without R#. I know if I type prop, I get an auto-property; that's all I need to know. :)
pdr
2010-02-18 20:21:38