What are you trying to accomplish?
Why are you trying exercise both as something different?
GUID’s are unique for the target object they are created for, you cannot convert a GUID from one to the another.
Know what you are seeing is a representation of exactly the same object. One as .Net and the other as LDAP. Here’s what you may need to comes to grips with when it comes to GUIDs proper taxonomy. Stick with one identifier or the other. The difference is in the formatting.
- `DirectoryEntry.NativeGUID` is displayed in little-endian order (without dashes) which is how it's stored "natively" in the directory service and
- `UserPricipal.GUID/DirectoryEntry.GUID` is displayed in big-endian order (with dashes). See the Wikipedia article on Endianess for details.
So when you print out the value for NativeGUID (a string) it should not show any dashes (like your example does) unless you create a new GUID using the string as input (`Guid ng = new Guid(de.NativeGuid);`). That will create some confusion...
The important thing is not to mix the two when storing the GUIDs in an external data source or storing a NativeGUID as a big-endian GUID, if that is what you are after.
The UserPricipal.GUID/DirectoryEntry.GUID is how the objectGUID attribute is displayed using most Windows management tools (such as Active Directory Users and Computers and ADSI Edit) and how it’s stored and displayed in SQL Server when you’d use the `uniqueidentifier` data type.
LDAP/ADSI offers up 3 Guids: objectGUID, Guid, NativeGuid and the native Guid and the Guid are the same.
.Net only has one, objectGuid.