Copyright Header
- 2 minutes to read
The Add Copyright Header Code Provider and the h template enable you to add a copyright comment at the beginning of a source code file. The default Copyright Header looks as follows:
//-----------------------------------------------------------------------
// <copyright file="«?FileName»" company="«?GetUserInfo(Company)»">
// Author: «?GetUserFirstName» «?GetUserLastName»
// Copyright (c) «?GetUserInfo(Company)». All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
This text is stored as an h template expansion. Templates support Text Commands and String Providers in their expansions. The default Copyright Header uses the following String Providers:
- «?FileName» — returns the current file’s full path.
- «?GetUserFirstName» — returns “First Name” value from the IDE | User Info options page.
- «?GetUserLastName» — returns “Last Name” value from the IDE | User Info options page.
- «?GetUserInfo(key)» — returns an arbitrary value from the IDE | User Info options page. You can specify which value to return using the key parameter.
You should configure the “First Name”, “Last Name” and “Company” fields on the IDE | User Info options page to use the default Copyright Header:
The Add Copyright Header and the h template generate the following text with the configuration above:
//-----------------------------------------------------------------------
// <copyright file="D:\Projects\CodeRushDemo\CodeRushDemo\Program.cs" company="Developer Express">
// Author: CodeRush User
// Copyright (c) Developer Express. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------