generating GUIDs using OpenNETCF

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
 
P

Peter Foot [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top