generating GUIDs using OpenNETCF

  • Thread starter Thread starter Glyn Meek
  • Start date Start date
G

Glyn Meek

Using the following code to try and generate a GUID doesn't work.

Imports OpenNETCF.GuidEx
....
Dim myNumber As Guid
myNumber = OpenNETCF.GuidEx.NewGuid

This fails to compile with the message :

Value of type 'OpenNETCF.GuidEx' cannot be converted to 'System.Guid'.

What am I doing wrong here, as the GuidEx code specifically states that
NewGuid returns a new "System.Guid" object

Thanks
 
This is a change in the latest code. The method now returns a System.Guid
type using the latest source code (and it will be this way in the v1.3
release). v1.2 and prior versions return an OpenNETCF.GuidEx structure which
is more or less the same but was deemed unnecessary - returning a standard
Guid makes it easier to interoperate with other code since Guid is a
standard base class type.
For current release versions you can convert in this (rather messy) way:-
myNumber = new Guid(OpenNETCF.GuidEx.NewGuid().ToByteArray())

Peter
 
Back
Top