Earlier this week, I already wrote about different idioms in different IDEs.
Here is another one, again a feature I don’t use often: getting a fresh GUID in the IDE.
Visual Studio
Most often you need it as part of your AssemblyInfo.cs file:
[assembly: ComVisible(false)] [assembly: Guid("5F36D50A-CF90-4677-82D3-07DC1E88AE43")]
Note may you need a Guid attribute inside your AssemblyInfo.cs, even if your ComVisible atrribute as you might have specific classes in your assembly that have ComVisible set to true.
To get a new GUID in your code editor, perform the steps from this video:
- Go to the TOOLS menu
- Click on the Create Guid submenu
- In the dialog, select the format you want, then
- Click on the Copy button, then
- Click on the Exit button, then
- In the code editor, paste the GUID
Someone should write a CodeRush extension to make this easier (:
Delphi
Usually you need a GUID as part of an interface declaration:
type IMyInterface = interface['{E432418F-433A-42A7-AA1B-9BA2560AF299}'] // ... end;
It is always wise to have a GUID on your Delphi interfaces, as without the GUID, the is and as operators will not work on interfaces.
The Delphi IDE has a shortcut to add a GUID in your source code, so only one step is needed:
–jeroen
Filed under: .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Delphi, Development, Software Development, Visual Studio and tools
