C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » General »

What is GUID ? How to generate a GUID ?


Posted Date: 11 Mar 2004    Resource Type: Articles    Category: General
Author: Tony JohnMember Level: Diamond    
Rating: 1 out of 5Points: 10



GUID stands for Globally Unique IDentifier. It is a string of
numbers and/or letters.


A GUID represents a Unique identifier - means you cannot generate the same GUID
more than once. A GUID has a very low (...practically impossible) probability of being duplicated


GUIDs have a variety of applications. You can use a GUID as a primary
key in your database table or in a several other scenarios. A good
example would be, if you have a distributed application where data is
generated and stored in various locations and you want to merge all those
data at some intervals of time, you may use GUID as the primary key.

GUIDs can be generated in a number of ways; most often a hash of
several things that might be unique at any given point in time like the IP
address plus the clock date/time etc are used to generate Unique Ids.
Each system may have slightly different algorithm to generate the Unique
Id.

In .net, you can use the System.Guid class to generate a GUID. See the
following sample code :

System.Guid guid = System.Guid.NewGuid ();
String id = guid.ToString();

System.Guid.NewGuid () returns a Guid object. You can use the
.ToString() method to convert it to a string. In the above example, you may get
a string which look like the following:

"b91c9121-0a17-4b26-a09d-d5980eb532db"


Can anyone generate the same Guid as shown above ? Try your luck !!



Responses

Author: Abhinav    18 Sep 2004Member Level: Bronze   Points : 0
It helped me a lot. i got an idea abt how to avoid multiple savings


Author: Sagar Laddha    12 Mar 2009Member Level: Bronze   Points : 1
Why can't the same GUID be generated? Is it just because of the huge number of possible values or because it is a combination of the algorithm?


Author: greeny_1984    13 Mar 2009Member Level: Diamond   Points : 2
hi,

you have mentioned

"A good
example would be, if you have a distributed application where data is
generated and stored in various locations and you want to merge all those
data at some intervals of time, you may use GUID as the primary key."

can you eleborate more on how to achieve this with a example



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: AutoPostBack - What it is and How it works ?
Previous Resource: How to convert C# code to Vb.net
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use