Check Guid

S

shapper

Hello,

I have a class (Box) where a property is a Guid, ID.
How can I test if this property was defined or not?

For example:
Box myBox = new Box();
myBox.Name = "Contacts"

if (myBox.Id "is not defined") { // Some code }

Can a Guid be null?

Thanks,
Miguel
 
U

usenet

Hello,

I have a class (Box) where a property is a Guid, ID.
How can I test if this property was defined or not?

For example:
Box myBox = new Box();
myBox.Name = "Contacts"

if (myBox.Id "is not defined") { // Some code }

Can a Guid be null?
[...]

Guid is a value-type, and cannot be null. Use Guid.Empty.

Regards,
 

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

Similar Threads

?? and Guid 9
Need advice on naming repositories methods. 3
ID or Id? 10
Check int 6
null Guid 7
Linq. Where 1
Class and XML file. Very strange problem. 1
accessing non-static members from static method 1

Top