Guid.NewGuid '-' character

  • Thread starter Thread starter Praveen
  • Start date Start date
P

Praveen

I'm using Guid.NewGuid() for generate unique ID
will there be 4 '-' alway in guid?

thanks,
Praveen
 
Praveen said:
I'm using Guid.NewGuid() for generate unique ID
will there be 4 '-' alway in guid?

I assume you mean if you call ToString() on the generated Guid. In that
case, the answer is yes. The format of the string returned by
guid.ToString() is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. As you can see,
four '-' characters in that string. However, the ToString method is
overloaded. If you pass "N" into ToString you'll get back a string of 32
digits with no hyphens. The format returned by ToString() is the same as
the format returned of you call the overload that takes a format specifier
and passing "D" as the format string - ToString("D").

See http://msdn2.microsoft.com/en-us/library/system.guid.tostring.aspx for
the various overloads of the ToString method. Browse into any of the
overloads that take in a format string to see the different formats that
could be returned.
 
Hi Praveen,

Do you think this post can be closed?


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Walter said:
Hi Praveen,

Do you think this post can be closed?

Wouldn't that be a question you should post to the original author of the
thread, not some who provided an answer? I don't know if the information I
provided satisfies his question or not.

Also understand that this is NNTP, the concept of closing a post is not
relevant. There may be internal MS tools where you track these things, but
since you use the same newsgroups for your managed MSDN newsgroups as your
public NNTP groups, in the latter context your question makes no sense.
 

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

Back
Top