Guid Attribute


Guid Attribute

Class

System.Runtime.InteropServices.GuidAttribute

Applies To

Assembly, Class, Delegate, Enum, Interface, Struct

Constructor

     New(guid) 


guid (required; String)

The GUID to be assigned to the program element

Properties


Value (String)

Read-only. Value from the guid constructor parameter.

Description

The <Guid> attribute assigns an explicit Globally Unique Identifier (GUID) to a program element when an automatically generated GUID is undesirable. The <Guid> attribute is used for COM interop. A GUID can be generated by a utility named guidgen.exe, which is included with Visual Studio.

Assigning a GUID to a program element, rather than allowing Visual Studio to do it automatically, ensures that it remains constant over successive recompilations of the source code. Because COM uses GUIDs to permanently identify program elements, inadvertently changing a GUID may cause COM to fail to recognize a component. Visual Studio automatically adds the <Guid> attribute to each AssemblyInfo.vb file to ensure that, should a type library be generated for a particular project, its library identifier (LibID) will remain unchanged when the project is recompiled.




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net