Solved

Generate a unique key value in code automatically

Posted on 2014-11-21
3
133 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:
Tchuki earned 500 total points
ID: 40457008
The Guid structure may be what you are looking for.
0
 
LVL 69

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now