Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System Namespace
Guid Structure
Guid Constructor
Collapse All/Expand All Collapse All
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Guid Constructor

Initializes a new instance of the Guid class.

  NameDescription
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGuid(array<Byte>[]()[])Initializes a new instance of the Guid class using the specified array of bytes.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGuid(String)Initializes a new instance of the Guid class using the value represented by the specified string.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGuid(Int32, Int16, Int16, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte)Initializes a new instance of the Guid class using the specified integers and bytes.
Public methodGuid(UInt32, UInt16, UInt16, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte)Initializes a new instance of the Guid class using the specified unsigned integers and bytes.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGuid(Int32, Int16, Int16, array<Byte>[]()[])Initializes a new instance of the Guid class using the specified integers and byte array.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
6th overload      Lost_In_JavaScript_Land   |   Edit   |   Show History
Within C#, there are actually 6 overloads to the Guid structure.

Guid g = new Guid(); // Creates a GUID structure with {00000000-0000-0000-0000-000000000000} as it's value.

Running the above code in C# will not throw an error, compiles perfectly, and the overload is defined within intellisense. This can cause confusion, especially when you're expecting a truly unique ID to be generated from the constructor. If you run into this, just simply replace "new Guid()" with "Guid.NewGuid()".
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker