ADP GUID to .NET GUID Converter

ADP GUID to .NET GUID Converter

Below is a link to download a quick and dirty hack to automatically convert ADP GUIDs to .NET GUIDs. Copy GUID from ADP site and paste into the top field...then click convert. Thank you to Prashanth Reddy for creating the logic code and making it available for all. I just packaged and compiled it. Written in C#; needs .NET 3.0 to run. Will catch invalid input with alert to keep CLR from crashing. Push Enter key to convert or Esc key to exit. IT'S BARE ESSENTIALS ONLY. Best to all. -CCK
4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks for the contribution CCK

You are very welcome. I appreciate the thanks. Figured I would help solve a common problem a lot of us have - GUID conversion.


Your excellent example had me thinking about the code implementation. I wrote a simple method that converts a standard ATOM SDK Guid to a .NET Guid type.

I have demonstrated the ToGuid method in the form of a simple .NET Console Project. Feel free to Download the project or see the pertinent portion below

Download URL 1: http://WWW.400KB.COM/go.php?ref=vHAYJuWpYfadbN6
Download URL 2:

/// Convert a native ATOM SDK GUID to a .NET Guid type
/// .NET Guid equivalent
private static Guid ToGuid(string nativeGuid)
// Check for null/empty guid string
if (String.IsNullOrEmpty(nativeGuid))
throw new ApplicationException("Empty or null guid string");

// Sanitize input by removing unwanted characters
string[] strReplaceStrings = new string[] { "0x", " ", ",", "\r", "\n" };
for (int i = 0; i < strReplaceStrings.Length; i++)
nativeGuid = nativeGuid.Replace(strReplaceStrings[i], String.Empty);

// Ensure we have a viable result to convert
if (nativeGuid.Length != 32)
throw new ApplicationException("Invalid guid string");

// Byte conversion
byte[] baBytes = new byte[nativeGuid.Length / 2];
for (int i = 0; i < baBytes.Length; i++)
bool bRes = byte.TryParse(nativeGuid.Substring(i * 2, 2),
out baBytes[(3 - (i % 4)) + ((i / 4) * 4)]);

// Ensure we could parse the string
if (!bRes)
throw new ApplicationException("Unable to parse guid string");

// New Guid
Guid guidResult = new Guid(baBytes);
return guidResult;

Leave a Comment

Please sign in to add a comment. Not a member? Join today