Is there a shortcut for class properties?

  • Thread starter Thread starter Mike Edgewood
  • Start date Start date
M

Mike Edgewood

Is there a simple way, shortcut, or macro to create a property
skeletons?

I would live to be able to type a name and a type and have the property
created based on that info.

Private mLastName as String
Public Property LastName() as String
Get
Return mLastName
End Get
Set (ByVal value as String)
mLastName = value
End Set
End Property


Is this possible?
 
Try code snippets.

In the code editor, type ? and hit Tab.

This brings up a menu of code snippets that you can insert.

When you drill down to the one you want (Common Code Patterns /
Properties and Procedures / Define a property), when it
shows the final list, if you hover your mouse over one,
or use the keyboard to highlight one, the tooltip will
give you a shortcut. For "Define a Property", it's "Property".

If you know the shortcut, you can use these in the code
editor by typing the shortcut and hitting Tab, and it will
insert the code for you.

So type Property<Tab> in the code editor, and it will insert
the structure for a property.

You can create your own Code Snippets, too. MS has a Code
Snippet Editor that lets you look at all of the ones already
there, as well as develop your own, that someone outside
of MS wrote, that works really well. Search MSDN for it
if you want it.

Good luck.
Robin S.
 
Thanks.

Too bad they don't offer a dialog box where you could just fill in
<privateVarName>, <PropName>, <Type>

Looking for ways to shortcut object creation for Object-Relational
mapping using CSLA.
 
Mike said:
Too bad they don't offer a dialog box where you could just fill in
<privateVarName>, <PropName>, <Type>

In a sense, it does. When you type Property<tab> you get a skeleton
with "fields". You just fill in the fields for the type,
privatemembernamd and property name. The rest is updated automatically.
 
Back
Top