Re: C# 3.0 partial methods and automatic properties
Sebastien Lorion <[email protected]> Sat, 11 Nov 2006 12:23:41 +0800
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
I think creating a code snippet would be more simple for this kind of task... Sébastien > -----Original Message----- > From: Discussion relating to the specifics of the C# and Managed C++ > languages [mailto:[email protected]] On Behalf Of Stoyan > Damov > Sent: Saturday, November 11, 2006 6:17 AM > To: [email protected] > Subject: Re: [DOTNET-CX] C# 3.0 partial methods and automatic > properties > > > The issue you bring up is a VERY valid one... you get the ability to > > change the method from the trivial stub to an actual method that does > > something for free (from recompile of clients). This allows you to > > standardize on the pattern of always having property accessors in a > > wrist-friendly way. > > Wow, what a terrific feature! You can record a macro[1] (ctrl-shift-r) > that does that in a few seconds. Below is a macro that when played > (ctrl-shift-p) on: > > string property[ctrl-shift-p] > > will replace it with > > private string property_; > public string Property > { > get > { > return property_; > } > set > { > property_ = value; > } > } > > [1] > Option Strict Off > Option Explicit Off > Imports System > Imports EnvDTE > Imports EnvDTE80 > Imports System.Diagnostics > > Public Module RecordingModule > > > Sub TemporaryMacro() > > DTE.ActiveDocument.Selection.StartOfLine(VsStartOfLineOptions.VsStartOf > LineOptionsFirstText, > True) > DTE.ActiveDocument.Selection.Copy() > DTE.ActiveDocument.Selection.EndOfLine() > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Paste() > DTE.ActiveDocument.Selection.LineUp() > DTE.ActiveDocument.Selection.EndOfLine() > DTE.ActiveDocument.Selection.WordLeft(True) > DTE.ActiveDocument.Selection.Copy() > > DTE.ActiveDocument.Selection.StartOfLine(VsStartOfLineOptions.VsStartOf > LineOptionsFirstText) > DTE.ActiveDocument.Selection.Text = "private " > DTE.ActiveDocument.Selection.EndOfLine() > DTE.ActiveDocument.Selection.Text = "_;" > DTE.ActiveDocument.Selection.LineDown() > > DTE.ActiveDocument.Selection.StartOfLine(VsStartOfLineOptions.VsStartOf > LineOptionsFirstText) > DTE.ActiveDocument.Selection.Text = "public " > DTE.ActiveDocument.Selection.EndOfLine() > DTE.ActiveDocument.Selection.WordLeft() > DTE.ActiveDocument.Selection.CharRight(True) > > DTE.ActiveDocument.Selection.ChangeCase(VsCaseOptions.VsCaseOptionsUppe > rcase) > DTE.ActiveDocument.Selection.EndOfLine() > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "{" > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "}" > DTE.ActiveDocument.Selection.LineUp() > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Indent() > DTE.ActiveDocument.Selection.Text = "get" > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "{" > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "}" > DTE.ActiveDocument.Selection.LineUp() > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Indent() > DTE.ActiveDocument.Selection.Text = "return " > DTE.ActiveDocument.Selection.Paste() > DTE.ActiveDocument.Selection.Text = "_;" > DTE.ActiveDocument.Selection.LineDown() > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "set" > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "{" > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Text = "}" > DTE.ActiveDocument.Selection.LineUp() > DTE.ActiveDocument.Selection.NewLine() > DTE.ActiveDocument.Selection.Indent() > DTE.ActiveDocument.Selection.Paste() > DTE.ActiveDocument.Selection.Text = "_ = value;" > End Sub > End Module > > Cheers, > Stoyan > > =================================== > This list is hosted by DevelopMentor® http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com