List Info

Thread: Guid Constructor




Guid Constructor
user name
2006-12-14 21:41:46
Which is probably called internally by Guid.NewGuid...

-----Original Message-----
From: Discussion of development on the .NET platform using
any managed
language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Efran
Cobisi
Sent: Thursday, December 14, 2006 11:16 AM
To: DOTNET-CLRDISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-CLR] Guid Constructor

Interesting enough, System.Guid has a private constructor
which accepts
a boolean argument which, basically, says if the newly
created instance
of the struct should be zero-initialized or generated by the
system.

Efran Cobisi
http://www.cobisi.com

Dan Farino wrote:
> There's also a technical reason: System.Guid is a value
type and, as
> such, it can't have an explicit parameterless
constructor. All the
> fields are zero-initialized by the CLR unless a
constructor taking an
> argument is called.
>
> -Dan
>
> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
> language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Efran
> Cobisi
> Sent: Thursday, December 14, 2006 2:50 AM
> To: DOTNET-CLRDISCUSS.DEVELOP.COM
> Subject: Re: [DOTNET-CLR] Guid Constructor
>
> I think this was a design driven decision. Since
creating a new Guid
is
> a time consuming task and one usually would not expect
to perform a
> lenghty operation inside a constructor, calling a
method would be more
> appropriate in this case.
>
> HTH,
>
> Efran Cobisi
> http://www.cobisi.com
>
> Brady Kelly wrote:
>
>> Why do I have to use the Guid.NewGuid static method
to create a new,
>>
> random
>
>> Guid?  A default, parameterless constructor seems
an ideal means to
do
>>
> this.
>
>> ===================================
>> This list is hosted by DevelopMentor(r)  http://www.develop.com
>>
>> View archives and manage your subscription(s) at
>>
> http://discuss.develop.com

>
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com

>

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


**********
This message contains information which may be confidential
and privileged. Unless you are the addressee (or authorized
to receive for the addressee), you may not use, copy or
disclose to anyone the message or any information contained
in the message. If you have received the message in error, 
please advise the sender by reply e-mail and delete the
message.

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )