ID Unique

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We know, C#, generate a Unique ID, for each visual element incorporate to its form. I need to create a unique ID to name my files, how can I do that, without have to create my own algorithm

I hope somebody can help me, thanks in advantage
 
Hector,

You can just use a new Guid, and then use the string representation for
that. That ID is guaranteed to be unique for something like the next 5000
years if you had generated 1000 per second during that time. It's going to
be ^pretty^ unique.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hector Martinez said:
We know, C#, generate a Unique ID, for each visual element incorporate
to its form. I need to create a unique ID to name my files, how can I do
that, without have to create my own algorithm.
 
If they are temp files, You can use System.IO.Path.GetTempFileName().
-mike
MVP

Hector Martinez said:
We know, C#, generate a Unique ID, for each visual element incorporate
to its form. I need to create a unique ID to name my files, how can I do
that, without have to create my own algorithm.
 
Back
Top