I am using the Guid.Empty value ("00000000-0000-0000-0000-000000000000") to
represent a special meaning. The problem is that I don't know if there is a
chance that a command like "Guid.NewGuid()"would generate a Guid.Empty value
could this be possible or is the "00000000-0000-0000-0000-000000000000" Guid
reserved or something like that?
Thank you. 9 34793
"Rene" <no****@nospam.com> wrote in message
news:Ok*************@TK2MSFTNGP10.phx.gbl... I am using the Guid.Empty value ("00000000-0000-0000-0000-000000000000") to represent a special meaning. The problem is that I don't know if there is a chance that a command like "Guid.NewGuid()"would generate a Guid.Empty value could this be possible or is the "00000000-0000-0000-0000-000000000000" Guid reserved or something like that?
Why not use a custom GUID for your special meaning?
The chances of a collision with some other GUID are
very very small. Remember, that low probability is
the whole reason GUID are in common use.
--
--Larry Brasfield
email: do***********************@hotmail.com
Above views may belong only to me.
"00000000-0000-0000-0000-000000000000" is in fact my custom Guid.
"Larry Brasfield" <do***********************@hotmail.com> wrote in message
news:e6*************@TK2MSFTNGP15.phx.gbl... "Rene" <no****@nospam.com> wrote in message news:Ok*************@TK2MSFTNGP10.phx.gbl...I am using the Guid.Empty value ("00000000-0000-0000-0000-000000000000") to represent a special meaning. The problem is that I don't know if there is a chance that a command like "Guid.NewGuid()"would generate a Guid.Empty value could this be possible or is the "00000000-0000-0000-0000-000000000000" Guid reserved or something like that?
Why not use a custom GUID for your special meaning? The chances of a collision with some other GUID are very very small. Remember, that low probability is the whole reason GUID are in common use.
-- --Larry Brasfield email: do***********************@hotmail.com Above views may belong only to me.
[top-posting maintained for inclarity]
To maximize the probability of a collision with some other
non-randomly generated "GUID", you could not choose
a better value than the one you propose.
--
--Larry Brasfield
email: do***********************@hotmail.com
Above views may belong only to me.
"Rene" <no****@nospam.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl... "00000000-0000-0000-0000-000000000000" is in fact my custom Guid.
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:e6*************@TK2MSFTNGP15.phx.gbl... "Rene" <no****@nospam.com> wrote in message news:Ok*************@TK2MSFTNGP10.phx.gbl...I am using the Guid.Empty value ("00000000-0000-0000-0000-000000000000") to represent a special meaning. The problem is that I don't know if there is a chance that a command like "Guid.NewGuid()"would generate a Guid.Empty value could this be possible or is the "00000000-0000-0000-0000-000000000000" Guid reserved or something like that?
Why not use a custom GUID for your special meaning? The chances of a collision with some other GUID are very very small. Remember, that low probability is the whole reason GUID are in common use.
All I really want to know is what are the chances that Guid.NewGuid() will
create a 00000000-0000-0000-0000-000000000000 value? What would it take for
the function to create such value?
"Larry Brasfield" <do***********************@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... [top-posting maintained for inclarity]
To maximize the probability of a collision with some other non-randomly generated "GUID", you could not choose a better value than the one you propose.
-- --Larry Brasfield email: do***********************@hotmail.com Above views may belong only to me.
"Rene" <no****@nospam.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl... "00000000-0000-0000-0000-000000000000" is in fact my custom Guid.
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:e6*************@TK2MSFTNGP15.phx.gbl... "Rene" <no****@nospam.com> wrote in message news:Ok*************@TK2MSFTNGP10.phx.gbl... I am using the Guid.Empty value ("00000000-0000-0000-0000-000000000000") to represent a special meaning. The problem is that I don't know if there is a chance that a command like "Guid.NewGuid()"would generate a Guid.Empty value could this be possible or is the "00000000-0000-0000-0000-000000000000" Guid reserved or something like that?
Why not use a custom GUID for your special meaning? The chances of a collision with some other GUID are very very small. Remember, that low probability is the whole reason GUID are in common use.
Guid.NewGuid() will return a string of zeros exactly as often as it will
return the value: {2C948FCC-035F-4a98-866E-4C9DF5FA7984}... which is very
remote indeed.
However, another developer may make the same mistake you are making, and
assume that their app is not running on the same machine as your app, and
that therefore, a string of zeros is a safe number. Statistically speaking,
that condition is far more likely than the possibility of Guid.NewGuid()
creating a duplicate number.
You are MUCH better off simply generating a GUID and using it. Then, you
are less likely to run into another programmer with a penchant for guessing
a random number.
This is precisely what Larry was trying to say.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Rene" <no****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... All I really want to know is what are the chances that Guid.NewGuid() will create a 00000000-0000-0000-0000-000000000000 value? What would it take for the function to create such value?
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... [top-posting maintained for inclarity]
To maximize the probability of a collision with some other non-randomly generated "GUID", you could not choose a better value than the one you propose.
-- --Larry Brasfield email: do***********************@hotmail.com Above views may belong only to me.
"Rene" <no****@nospam.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl... "00000000-0000-0000-0000-000000000000" is in fact my custom Guid.
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:e6*************@TK2MSFTNGP15.phx.gbl... "Rene" <no****@nospam.com> wrote in message news:Ok*************@TK2MSFTNGP10.phx.gbl... >I am using the Guid.Empty value >("00000000-0000-0000-0000-000000000000") to represent a special >meaning. The problem is that I don't know if there is a chance that a >command like "Guid.NewGuid()"would generate a Guid.Empty value could >this be possible or is the "00000000-0000-0000-0000-000000000000" Guid >reserved or something like that?
Why not use a custom GUID for your special meaning? The chances of a collision with some other GUID are very very small. Remember, that low probability is the whole reason GUID are in common use.
Thanks Nick.
I understood what Larry was saying, I was more curious than anything else,
you see, as you know, the Guid has a specific property called Empty that
represents the 0000...., that's why I was thinking that maybe the 0000....
was reserved for that special purpose (kind of like null in databases to
represent nothing) and it was impossible to get it though Guid.NewGuid().
Plain curiosity.
"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> wrote in message
news:tt********************@comcast.com... Guid.NewGuid() will return a string of zeros exactly as often as it will return the value: {2C948FCC-035F-4a98-866E-4C9DF5FA7984}... which is very remote indeed.
However, another developer may make the same mistake you are making, and assume that their app is not running on the same machine as your app, and that therefore, a string of zeros is a safe number. Statistically speaking, that condition is far more likely than the possibility of Guid.NewGuid() creating a duplicate number.
You are MUCH better off simply generating a GUID and using it. Then, you are less likely to run into another programmer with a penchant for guessing a random number.
This is precisely what Larry was trying to say.
-- --- Nick Malik [Microsoft] MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not representative of my employer. I do not answer questions on behalf of my employer. I'm just a programmer helping programmers. -- "Rene" <no****@nospam.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... All I really want to know is what are the chances that Guid.NewGuid() will create a 00000000-0000-0000-0000-000000000000 value? What would it take for the function to create such value?
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... [top-posting maintained for inclarity]
To maximize the probability of a collision with some other non-randomly generated "GUID", you could not choose a better value than the one you propose.
-- --Larry Brasfield email: do***********************@hotmail.com Above views may belong only to me.
"Rene" <no****@nospam.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl... "00000000-0000-0000-0000-000000000000" is in fact my custom Guid.
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:e6*************@TK2MSFTNGP15.phx.gbl... > "Rene" <no****@nospam.com> wrote in message > news:Ok*************@TK2MSFTNGP10.phx.gbl... >>I am using the Guid.Empty value >>("00000000-0000-0000-0000-000000000000") to represent a special >>meaning. The problem is that I don't know if there is a chance that a >>command like "Guid.NewGuid()"would generate a Guid.Empty value could >>this be possible or is the "00000000-0000-0000-0000-000000000000" Guid >>reserved or something like that? > > > Why not use a custom GUID for your special meaning? > The chances of a collision with some other GUID are > very very small. Remember, that low probability is > the whole reason GUID are in common use.
Shouldn't a completely zero guid be impossible to get from Guid.NewGuid() as
between the variant and version fields there ought to be at least one bit
set? Or am I mistaken in thinking Guids follow a standard format
( http://www.webdav.org/specs/draft-le...guids-01.txt)?
I don't argue the point that Guid.Empty should be used with care to avoid
collision due to its being used as a sentinel by other developers, but I
don't think you should need to worry about it colliding with
machine-generated values.
Just curious.
"Nick Malik [Microsoft]" wrote: Guid.NewGuid() will return a string of zeros exactly as often as it will return the value: {2C948FCC-035F-4a98-866E-4C9DF5FA7984}... which is very remote indeed.
However, another developer may make the same mistake you are making, and assume that their app is not running on the same machine as your app, and that therefore, a string of zeros is a safe number. Statistically speaking, that condition is far more likely than the possibility of Guid.NewGuid() creating a duplicate number.
You are MUCH better off simply generating a GUID and using it. Then, you are less likely to run into another programmer with a penchant for guessing a random number.
This is precisely what Larry was trying to say.
-- --- Nick Malik [Microsoft] MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not representative of my employer. I do not answer questions on behalf of my employer. I'm just a programmer helping programmers. -- "Rene" <no****@nospam.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... All I really want to know is what are the chances that Guid.NewGuid() will create a 00000000-0000-0000-0000-000000000000 value? What would it take for the function to create such value?
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... [top-posting maintained for inclarity]
To maximize the probability of a collision with some other non-randomly generated "GUID", you could not choose a better value than the one you propose.
-- --Larry Brasfield email: do***********************@hotmail.com Above views may belong only to me.
"Rene" <no****@nospam.com> wrote in message news:OI**************@TK2MSFTNGP09.phx.gbl... "00000000-0000-0000-0000-000000000000" is in fact my custom Guid.
"Larry Brasfield" <do***********************@hotmail.com> wrote in message news:e6*************@TK2MSFTNGP15.phx.gbl... > "Rene" <no****@nospam.com> wrote in message > news:Ok*************@TK2MSFTNGP10.phx.gbl... >>I am using the Guid.Empty value >>("00000000-0000-0000-0000-000000000000") to represent a special >>meaning. The problem is that I don't know if there is a chance that a >>command like "Guid.NewGuid()"would generate a Guid.Empty value could >>this be possible or is the "00000000-0000-0000-0000-000000000000" Guid >>reserved or something like that? > > > Why not use a custom GUID for your special meaning? > The chances of a collision with some other GUID are > very very small. Remember, that low probability is > the whole reason GUID are in common use.
My mistake. You are correct. an all-zero GUID is not possible from
Guid.NewGuid().
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Jeremy Davis" <Je*********@discussions.microsoft.com> wrote in message
news:66**********************************@microsof t.com... Shouldn't a completely zero guid be impossible to get from Guid.NewGuid() as between the variant and version fields there ought to be at least one bit set? Or am I mistaken in thinking Guids follow a standard format (http://www.webdav.org/specs/draft-le...guids-01.txt)? I don't argue the point that Guid.Empty should be used with care to avoid collision due to its being used as a sentinel by other developers, but I don't think you should need to worry about it colliding with machine-generated values. Just curious.
"Nick Malik [Microsoft]" wrote:
Guid.NewGuid() will return a string of zeros exactly as often as it will return the value: {2C948FCC-035F-4a98-866E-4C9DF5FA7984}... which is very remote indeed.
However, another developer may make the same mistake you are making, and assume that their app is not running on the same machine as your app, and that therefore, a string of zeros is a safe number. Statistically speaking, that condition is far more likely than the possibility of Guid.NewGuid() creating a duplicate number.
You are MUCH better off simply generating a GUID and using it. Then, you are less likely to run into another programmer with a penchant for guessing a random number.
This is precisely what Larry was trying to say.
-- --- Nick Malik [Microsoft] MCSD, CFPS, Certified Scrummaster http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not representative of my employer. I do not answer questions on behalf of my employer. I'm just a programmer helping programmers. -- "Rene" <no****@nospam.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... > All I really want to know is what are the chances that Guid.NewGuid() > will > create a 00000000-0000-0000-0000-000000000000 value? What would it take > for the function to create such value? > > > "Larry Brasfield" <do***********************@hotmail.com> wrote in > message > news:%2****************@tk2msftngp13.phx.gbl... >> [top-posting maintained for inclarity] >> >> To maximize the probability of a collision with some other >> non-randomly generated "GUID", you could not choose >> a better value than the one you propose. >> >> -- >> --Larry Brasfield >> email: do***********************@hotmail.com >> Above views may belong only to me. >> >> "Rene" <no****@nospam.com> wrote in message >> news:OI**************@TK2MSFTNGP09.phx.gbl... >>> "00000000-0000-0000-0000-000000000000" is in fact my custom Guid. >>> >>> "Larry Brasfield" <do***********************@hotmail.com> wrote in >>> message news:e6*************@TK2MSFTNGP15.phx.gbl... >>>> "Rene" <no****@nospam.com> wrote in message >>>> news:Ok*************@TK2MSFTNGP10.phx.gbl... >>>>>I am using the Guid.Empty value >>>>>("00000000-0000-0000-0000-000000000000") to represent a special >>>>>meaning. The problem is that I don't know if there is a chance that >>>>>a >>>>>command like "Guid.NewGuid()"would generate a Guid.Empty value could >>>>>this be possible or is the "00000000-0000-0000-0000-000000000000" >>>>>Guid >>>>>reserved or something like that? >>>> >>>> >>>> Why not use a custom GUID for your special meaning? >>>> The chances of a collision with some other GUID are >>>> very very small. Remember, that low probability is >>>> the whole reason GUID are in common use. >> >> > >
Guid.Empty is special but only int he context of .NET.
Guid is a value type and as such can not be null. Therefore, whenever
you declare a variable of type Guid that variable is automatically
initialized to a zero value. Since Guid isn't nullable, you can't
check if it's null. Therefore, to check if a Guid has been
initialized to a real generated Guid value compare it to Guid.Empty.
So instead of
// generates error...
if (myGuid != null) {
}
you use
if (myGuid != Guid.Empty) {
}
So Guid.Empty does have special meaning equivalent to a null value for
a reference type. That should be reason enough not to use it in your
app for some other purpose (besides the reasons already
mentioned--collision with another developer making the same assumption
as you).
HTH,
Sam
On Fri, 4 Mar 2005 02:04:01 -0600, "Rene" <no****@nospam.com> wrote: Thanks Nick. I understood what Larry was saying, I was more curious than anything else, you see, as you know, the Guid has a specific property called Empty that represents the 0000...., that's why I was thinking that maybe the 0000.... was reserved for that special purpose (kind of like null in databases to represent nothing) and it was impossible to get it though Guid.NewGuid(). Plain curiosity.
B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alexander Muylaert |
last post by:
Hi
Does anybody has an idea how to have guids, created on many computers,
sorted by Timestamp? It doesn't have to be very accurate, but it would mean
a great optimization for my datastructures....
|
by: George |
last post by:
I want to create a unique id for each of a set of objects.
These ids may be generated on multiple machines simultaneously and must all
be different to each other.
There are an undefined number...
|
by: csharper |
last post by:
Why does Guid.GetHashcode() returns 0 when instantiated with Guid.Empty
?
|
by: Pohihihi |
last post by:
I guess I am forgetting some rules, why I am not able to do following, says it is read only --
Guid a = new Guid;
foreach(Guid b in a)
b = Guid.Empty;
but can do as following --
int c =...
|
by: Charles Hunt |
last post by:
Hi,
When running this code in VB2003
Sub guidtest()
Dim gstring As String
Dim gid As Guid
|
by: Michael Primeaux |
last post by:
I have a simple .NET 2.0 web service created with VS.NET 2005 with a single
web method with the following signature:
void HelloWorld(Guid parameter1);
When calling this method I receive the...
|
by: newbienew |
last post by:
What is the maximum value of a GUID... is it possible to get the
maximum value from a method or property like Guid.Empty?
|
by: Ronald S. Cook |
last post by:
I have a function in which I'm trying to make the parameter optional.
However, when I put Optional in front of ByVal below I get the error
"optional parameters cannot have structure types".
...
|
by: Peter K |
last post by:
Hi - should the following compile? I ask because a Guid is a struct and can
never be null... The worst the compiler throws at me is an "unreachable
code" warning.
public string GetData(Guid id)...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
| |