Sitecore 5.1.1 API

MainUtil.IsID Method 

Checks if string is a valid GUID.

[Visual Basic]
Public Shared Function IsID( _
   ByVal id As String _
) As Boolean
[C#]
public static bool IsID(
   string id
);

Parameters

id
A string.

Return Value

True, if the string is a GUID, otherwise false.

Remarks

The function checks that the length of the string id, starts with a starting brace ({) and ends with closing brace (}).

Example

  string id = StringUtil.GetString(Request.QueryString["id"]);
  if (MainUtil.IsID(id)) {
    IMasterItem item = MasterFactory.GetItem(id);
  }

See Also

MainUtil Class | Sitecore Namespace