Pages

2006/04/21

Write Code Without Having to Type It

Subscribe to SQL Server Magazine: http://lists.sqlmag.com/t?ctl=27C27:610454

====================

To ensure that future email messages you receive from Developer .NET UPDATE aren't mistakenly blocked by antispam software, be sure to add Developer_dotNET_UPDATE@lists.sqlmag.com to your list of allowed senders and contacts.

====================

This email newsletter comes to you free and is supported by the following advertisers, who offer products and services that might interest you. Please take a moment to visit these advertisers' Web sites and show your support for Developer .NET UPDATE.

Double-Take Software http://lists.sqlmag.com/t?ctl=27C21:610454

Macrovision http://lists.sqlmag.com/t?ctl=27C1F:610454

=================================

1. Developer .NET Perspectives - Write Code Without Having to Type It

2. Events and Resources - Guide to SQL Server 2005 High Availability - Exploit the Opportunities of a Wireless Fleet - Are You a SQL Server Superhero? - Become a Master of Messaging

3. Featured White Paper - Secure Your Online Data Transfer with SSL

4. Announcements - Exclusive Spring Savings - Save 44% off the Windows IT Security Newsletter

==== Sponsor: Double-Take Software ====

Start your disaster recovery program before it's too late - including defining the right plan for you, and mistakes to avoid when planning. http://lists.sqlmag.com/t?ctl=27C21:610454

=================================

1. ==== Developer .NET Perspectives ==== by Bill Sheldon, bills@interknowlogy.com

Write Code Without Having to Type It A lot of the code that developers write follows common patterns. For example, when you create a new property, you follow four steps: 1. Declare a private variable. 2. Declare the public property with a public name of the same type. 3. Declare the Set logic, which sets the private variable to the parameter value. 4. Declare the Get logic, which returns the private variable's value.

These four steps are common to every property you want to place in a class. Manually typing all that information is not only repetitive but also time consuming and error prone (mainly typing errors). Visual Studio 2005 lets you avoid all that hassle. Its new code snippet feature lets you include code without typing it. For example, to include code that creates a property, you simply type "prop" if you're using Visual C# or "property" if you're using Visual Basic (VB) 2005, then press the Tab key. In your source code, you'll find a template that includes all the generic code you would normally type. The sections that you need to edit in your new property declaration (e.g., variable name, property name, type) are all highlighted. After you edit the contents of a highlighted section, you press the Tab key to go to the next section. The changes are reflected across the entire declaration for consistency. This constitutes an important difference between using this feature and uploading stock code. With this feature, you're literally pulling in a code template with active tags that specify the initial customizable properties in that template. Most all the keywords in VB 2005 or Visual C# have been associated with a code snippet. Can't remember the exact syntax of the For loop? No worries. Type "For", press the Tab key, and--poof--the necessary code appears. Can't remember the keyword you need to use? No problem. Right-click somewhere in your edit window and select Insert Snippet. Visual Studio 2005 first inserts a placeholder in the location where you want to include a snippet, then provides a list of snippet categories in the Code Snippet Picker. Visual Studio 2005's code snippet feature goes well beyond just providing templates for common language elements. Templates are also provided for common tasks, such as pinging a remote computer or connecting to a database. In addition, a template contains more than just source code. The template also includes additional information, such as the snippet's author, the namespaces that need to be imported (if applicable), a display title, keywords the user needs to edit, and which keyword should be edited first. For general information about code snippets, you can check out the Visual C# help files at http://lists.sqlmag.com/t?ctl=27C2F:610454 . The good news is that Visual Studio 2005 shipped with hundreds of code snippets. The bad news is that the snippets are, as you might expect, language specific and therefore not interchangeable. For example, some of the VB 2005 snippets leverage the "My" namespace, which doesn't exist in Visual C#. The code snippets have their own schema, which is documented at http://lists.sqlmag.com/t?ctl=27C34:610454 . As a result, you can create your own custom snippets. Step by step instructions for doing so are available at http://lists.sqlmag.com/t?ctl=27C35:610454 . Snippet files are XML files. So, to create snippets, you must edit an XML file, which isn't much fun. Fortunately, if you use VB 2005, there's a GUI called the Visual Basic Snippet Editor that you can use. This free editor is currently in the release candidate (RC) stage. For more information, visit the Microsoft Developer Network (MSDN) Web page at http://lists.sqlmag.com/t?ctl=27C28:610454 . Or for the most recent version, bypass MSDN and look in the GotDotNet Workspace at http://lists.sqlmag.com/t?ctl=27C20:610454 .

==== Sponsor: Macrovision ====

Strategically manage your organization's software licenses with a 5-step program to help save time and cut costs by centralizing licensing operations. http://lists.sqlmag.com/t?ctl=27C1F:610454

=================================

2. ==== Events and Resources ==== (brought to you by SQL Server Magazine)

Guide to SQL Server 2005 High Availability Learn the essentials of high availability for SQL Server 2005--including cluster services, replication, and log shipping. http://lists.sqlmag.com/t?ctl=27C24:610454

Exploit the Opportunities of a Wireless Fleet Industry guru Randy Franklin Smith helps you identify what you should do to leverage your mobile and wireless infrastructure, how to pick devices that are right for you, and more! http://lists.sqlmag.com/t?ctl=27C22:610454

Are You a SQL Server Superhero? Take our free pop quiz to prove that you are, and you'll be entered to win a PSP! http://lists.sqlmag.com/t?ctl=27C31:610454

Become a Master of Messaging Gain control of your messaging data with step-by-step instructions for complying with the law, ensuring your systems are working properly, and ultimately making your job easier. http://lists.sqlmag.com/t?ctl=27C25:610454

3. ==== Featured White Paper ====

Secure Your Online Data Transfer with SSL Increase your customers' confidence and your business by securely collecting sensitive information online. In this free white paper, you'll learn about the various applications of SSL certificates and how to deploy them appropriately, along with details of how to test SSL on your Web server. http://lists.sqlmag.com/t?ctl=27C26:610454

==== 2006 Watch ====

Learn C# 2005 Now...Get a FREE training CD! Start learning Visual C# 2005 today with cutting edge training from AppDev. We'll send you a C# 2005 training CD from our new course (a $115 value) -- FREE! Start learning now...click the link below for your FREE Visual C# 2005 training. http://lists.sqlmag.com/t?ctl=27C30:610454

4. ==== Announcements ==== (brought to you by SQL Server Magazine)

Exclusive Spring Savings Subscribe to Windows IT Pro and SAVE 58%! Along with your 12 issues, you'll get FREE access to the entire Windows IT Pro online article archive, which houses more than 9,000 helpful articles. This is a limited-time offer, so order now: http://lists.sqlmag.com/t?ctl=27C2A:610454

Save 44% off the Windows IT Security Newsletter For a limited time, order the Windows IT Security newsletter and SAVE up to $80! You'll get 12 helpful issues loaded with endless fundamentals on building and maintaining a secure enterprise, in-depth product coverage of the best security tools available, and expert advice on the best way to implement various security components. Subscribe now: http://lists.sqlmag.com/t?ctl=27C2B:610454

==== Hot Spot ====

Find solutions to manage multiple regulations effectively, saving time and expense when demonstrating compliance. http://lists.sqlmag.com/t?ctl=27C23:610454

==== Contact Us ====

About Developer .NET Perspectives -- bills@interknowlogy.com About the newsletter -- letters@sqlmag.com About technical questions -- http://lists.sqlmag.com/t?ctl=27C32:610454 About product news -- products@sqlmag.com About your subscription -- Developer_dot_NET_update@sqlmag.com About sponsoring an UPDATE -- contact Richard Resnick, rresnick@sqlmag.com, or Lisa Kling, lkling@sqlmag.com

=================================

Developer .NET UPDATE is brought to you by SQL Server Magazine, the only magazine devoted to helping developers and DBAs master new and emerging SQL Server technologies and issues. Subscribe today. http://lists.sqlmag.com/t?ctl=27C29:610454

Manage Your Account You are subscribed as news-and-stuff@arconati.us

You are receiving this email message because you subscribed to this newsletter on our Web site. To unsubscribe, click the unsubscribe link: http://penton.whatcounts.com/u?id=28351AE7DCFB1F6CA130D7D6A537132E

You can manage your SQL Server Magazine email newsletter subscriptions by going to http://lists.sqlmag.com/t?ctl=27C33:610454 .

You can view the SQL Server Magazine Privacy Policy at http://lists.sqlmag.com/t?ctl=27C2E:610454 .

SQL Server Magazine is a division of Penton Media, Inc. 221 East 29th Street, Loveland, CO 80538, Attention: Customer Service Department

Copyright 2006, Penton Media, Inc. All Rights Reserved.

No comments:

Post a Comment

Keep a civil tongue.