Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Highlight a member variable and create get/set
 New Topic  Topic Locked
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

hebbja
Junior Member

United Kingdom
23 Posts

Posted - Mar 09 2004 :  06:00:08 AM  Show Profile
Back to the original request. If you want to (re)expose a public field through get/set functions, try a refactoring tool (or wait for Whidbey...)
C# Refactory <http://www.xtreme-simplicity.net> (I've used this and its OK. Not perfect)

James Hebben
Go to Top of Page

homawong
Junior Member

USA
12 Posts

Posted - Nov 29 2004 :  1:57:57 PM  Show Profile
Here is two code templates I wrote myself. They are not refactoring the code, and they are written in C#. But I believe you can make changes to it to your liking.




Add Property:
#region Property %2
private %1 _%2;
#region Comments
/// <summary>
/// Gets or Sets -?
/// </summary>
#endregion
public %1 %2
{
get{return _%2;}
set{_%2 = value;}
}
#endregion




Add String Property:
#region Property %1
private string _%1;
#region Comments
/// <summary>
/// This is the MaxLength of %1
/// </summary>
#endregion
public static int Limit%1 = 25;
#region Comments
/// <summary>
/// Gets or Sets -?
/// </summary>
#endregion
public string %1
{
get{return _%1;}
set
{
if (value.Length > Limit%1)
throw new ArgumentException("Cannot exceed " + Limit%1 + " characters", "%1");
_%1 = value;
}
}
#endregion



Happy Coding
Go to Top of Page

homawong
Junior Member

USA
12 Posts

Posted - Nov 29 2004 :  2:06:25 PM  Show Profile
Here are two templates that I use. They are not refactoring, but I think it would be useful. They are written in C# and I have my own convention of naming the variables. But you can modify the code to your liking.



Add Property:
#region Property %2
private %1 _%2;
#region Comments
/// <summary>
/// Gets or Sets -?
/// </summary>
#endregion
public %1 %2
{
get{return _%2;}
set{_%2 = value;}
}
#endregion


Add String Property:
#region Property %1
private string _%1;
#region Comments
/// <summary>
/// This is the MaxLength of %1
/// </summary>
#endregion
public static int Limit%1 = 25;
#region Comments
/// <summary>
/// Gets or Sets -?
/// </summary>
#endregion
public string %1
{
get{return _%1;}
set
{
if (value.Length > Limit%1)
throw new ArgumentException("Cannot exceed " + Limit%1 + " characters", "%1");
_%1 = value;
}
}
#endregion


Happy coding,
Homa Wong
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000