Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 27th, 2006, 02:35 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Default code question

Hello,

My question is...where are the default code template files located and can they be altered?

Reason...When I write a program, I like to put my name, date, version, version history and a description of the file above all the code that is created. I would like to add this text to the code that gets created so that I do not have to copy and paste every time I do a new project.

Example of what I mean:


/* FILE NAME:
 * DATE:
 * AUTHOR:
 * VERSION: 1.0
 * VERSION HISTORY:
 *
 * DESCRIPTION:
 *
 ************************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace Ch05Ex01
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}


Any help is greatly appreciated.
Thanks in advance.

Fikus

 
Old November 27th, 2006, 04:55 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Fikus,

You can design a new class the way you want it, and then export it through File | Export Template in Visual Studio 2005.

After you exported the class file, it becomes available as an item in the Add New Item dialog.

Hope this helps,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old November 27th, 2006, 05:39 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

Thanks for the info. I did what you said and got it to work. I did not know if I would be able to change the "default" code that was generated like you can with Java. Thanks again.

Fikus

 
Old November 27th, 2006, 05:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Fikus,

Yes, it does. You can use a number of placeholders in your file that are replaced at run-time, including the class name, namespace etc. Take a look here for a full list: http://msdn2.microsoft.com/en-us/library/eehb4faa(VS.80).aspx

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on hastable code petfrog BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 February 22nd, 2008 05:15 PM
Binding Navigator Button Default Code Question dmagnant Visual Studio 2005 0 September 29th, 2007 10:02 AM
Adding code question zoidberg BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 5th, 2006 02:25 PM
Question on reusing code billb VBScript 0 August 18th, 2006 10:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.