Solved

Generate a unique key value in code automatically

Posted on 2014-11-21
3
143 Views
Last Modified: 2014-11-21
In database tables there is the possibility to automatically generate a unique primary key for a record.

What I would like is this sort of functionality BUT nothing to do with a database.  The data will be structured (tree like) and handled in the app.  I had the thought that maybe there is a built in class in C# that I can use to generate a unique value as an identifier.
I can code one myself so I am asking only about a built in, ready to use class if there is one.
0
Comment
Question by:AndyAinscow
3 Comments
 
LVL 14

Accepted Solution

by:
Vel Eous earned 500 total points
ID: 40457008
The Guid structure may be what you are looking for.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 40457035
0
 
LVL 44

Author Closing Comment

by:AndyAinscow
ID: 40457159
Nice idea.  Simple to implement and, these days, memory isn't a real constraint anymore in most cases.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SqlDataBase 7 54
Hey!!!! 1 29
Where is this file? 3 26
Input parameteres to DragOver 2 20
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question