Check Guid

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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

Check int 6
?? and Guid 9
Remove from List 2
ID or Id? 10
Property Default Value 3
Need advice on naming repositories methods. 3
Class and XML file. Very strange problem. 1
Linq. Where 1

Back
Top