• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8951
  • Last Modified:

How do I check if a GUID is nothing or null?

How do I check if a GUID is nothing or null?
Is there a built in function lfor this?
0
mattphung
Asked:
mattphung
  • 2
1 Solution
 
Solar_FlareCommented:
just use the usual check for nothing/null

c#: if (objGUID == null)
vb: if IsNothing(objGUID) then
0
 
mattphungAuthor Commented:
i tried:
if objGUID = nothing then
 
I get an error message "=" is not defined for type "system.GUID"

why does " Isnothing()" works but "= nothing" doesn't?
0
 
Solar_FlareCommented:
in VB.NET you can't compare an object ot nothing like that. You should also be able to use

if objGUID is nothing then


but the same applies, you cant use =nothing like you can use == null in c#
0
 
Bob LearnedCommented:
C#:
   if (guidVariable == Guid.Empty)

VB.NET:
  If guidVariable.Equals(Guid.Empty) Then

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now