473,395 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Better way to write if (PenID.ToString() != "00000000-0000-0000-0000-000000000000")?

Given that PenID is a Guid, is there a better way to write this?

if (PenID.ToString() != "00000000-0000-0000-0000-000000000000")
I thought I could do some sort of Guid.Empty check or something.

Thanks,
Ron
Jun 30 '07 #1
2 2395
Hi,

If PenID's type is Guid also, so it can be like: PenID.Equals(Guid.Empty)

Regards, Alex
http://devkids.blogspot.com
Given that PenID is a Guid, is there a better way to write this?

if (PenID.ToString() != "00000000-0000-0000-0000-000000000000")

I thought I could do some sort of Guid.Empty check or something.

Thanks,
Ron

Jun 30 '07 #2
Ronald S. Cook <rc***@westinis.comwrote:
Given that PenID is a Guid, is there a better way to write this?

if (PenID.ToString() != "00000000-0000-0000-0000-000000000000")
I thought I could do some sort of Guid.Empty check or something.
if (penID != Guid.Empty)
{
....
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dean Bortell | last post by:
I have a program that encrypts a datetime objects "to long datetime string" string to and encrypted sequence. The problem is this: if I use the following source code it works (key is declared...
9
by: msuk | last post by:
All, I have a well form block of XML that is stored in a C# string type and I just simply want to display it in the browser using Response.Write but when I try this I get the following error: ...
13
by: Pohihihi | last post by:
I am getting Guid using new Guid() when I say new Guid().ToString() I get 10856f25-2759-0358-159c-ff7e0759c800 but when I say
8
by: Naz | last post by:
Hi, I am new in C# and converting a program from delphi to C#. I have to store a list of strings in memory and also need to save the strings to disk at the end. I use StringCollection and my...
0
by: Frank | last post by:
Hello, following problem: I have written a custom format provider MyFormatInfo (which implements IFormatProvider and ICustomProvider). When I write String.Format(new MyFormatInfo(),...
2
by: Jon | last post by:
Hello all, I think I must be missing something here as it seems it should be simple, but I've just tried to do a 'arrExtRep.ToString() (where arrItems is an ArrayList) and I get the error: ...
101
by: Sean | last post by:
Book I am reading says that Cstr() is best method for efficency and safety however it doesnt compare that method of the .ToString() method. Which is best. Thanks
5
by: =?Utf-8?B?RmFlc3NsZXIgR2lsbGVz?= | last post by:
Hello, I'm facing a strange problem. We have an Asp.net 2.0 Web Application and somehow the date format is changing from one client to another even if all the code is running server-side... ...
3
by: sriram347 | last post by:
Hi I am a newbie to ASP.NET. I developed a web page (project type is web application) and I keep getting this error. B]Error message : "System.AccessViolation Exception attempted to read or...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.