Export (0) Print
Expand All

Guid.TryParse Method

Updated: August 2011

Converts the string representation of a GUID to the equivalent Guid structure.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

static member TryParse : 
        input:string * 
        result:Guid byref -> bool 

Parameters

input
Type: System.String
The GUID to convert.
result
Type: System.Guid%
The structure that will contain the parsed value.

Return Value

Type: System.Boolean
true if the parse operation was successful; otherwise, false.

This method returns false if input is a null reference (Nothing in Visual Basic) or not in a recognized format, and does not throw an exception.

The following example creates a new GUID, converts it to three separate string representations by calling the ToString method with the "B", "D", and "X" format specifiers, and then calls the TryParse method to convert the strings back to Guid values.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Date

History

Reason

August 2011

Replaced the example.

Information enhancement.

Community Additions

ADD
Show:
© 2014 Microsoft