Click here to Skip to main content
15,908,264 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# friendly guid Pin
Member 400536019-Feb-09 4:23
Member 400536019-Feb-09 4:23 
GeneralRe: C# friendly guid Pin
Calin Tatar19-Feb-09 4:27
Calin Tatar19-Feb-09 4:27 
GeneralRe: C# friendly guid Pin
Member 400536019-Feb-09 4:30
Member 400536019-Feb-09 4:30 
GeneralRe: C# friendly guid Pin
Calin Tatar19-Feb-09 4:35
Calin Tatar19-Feb-09 4:35 
GeneralRe: C# friendly guid Pin
Thomas Stockwell19-Feb-09 5:26
professionalThomas Stockwell19-Feb-09 5:26 
GeneralRe: C# friendly guid Pin
Calin Tatar19-Feb-09 4:34
Calin Tatar19-Feb-09 4:34 
AnswerRe: C# friendly guid Pin
Ennis Ray Lynch, Jr.19-Feb-09 4:12
Ennis Ray Lynch, Jr.19-Feb-09 4:12 
GeneralRe: C# friendly guid Pin
Mirko198019-Feb-09 4:39
Mirko198019-Feb-09 4:39 
Having also numbers, I guess it's a base-62 number.
Making some calculation, 11 base-62 digits are roughly equivalent to 64 base-2 digits.

So I guess that a code like 3Ie7Y3GHayk is a base-62 encoded Int64 value.

A guid is 128 bits, so, if you want to generate this code starting from a Guid you must use half of it. I'm not sure that doing so introduces the risk of conflicting ids.

If you want something quick&dirty, you could try the following code (I used base64 that is directly provided by the framework, but keep in mind that the resulting string can containg characters like '/' or '+' that might cause problems when put in urls). Otherwise you must write your own encoding algorithm.

Guid guid = Guid.NewGuid(); // original GUID
byte[] guidArray = guid.ToByteArray(); // byte array containing GUID data
byte[] halfArray = new byte[8]; // byte array that will contain half GUID data
Array.Copy(guidArray, halfArray, halfArray.Length); // getting half GUID (first half, maybe the second half is better???)
string id = Convert.ToBase64String(halfArray).Substring(0, 11); // convering into base64 and removing the trailing '='

GeneralRe: C# friendly guid Pin
Ennis Ray Lynch, Jr.19-Feb-09 4:42
Ennis Ray Lynch, Jr.19-Feb-09 4:42 
GeneralRe: C# friendly guid Pin
Mirko198019-Feb-09 5:25
Mirko198019-Feb-09 5:25 
QuestionRe: C# friendly guid Pin
Eddy Vluggen19-Feb-09 4:47
professionalEddy Vluggen19-Feb-09 4:47 
QuestionGet Window Thread ProcessId Pin
frommi19-Feb-09 3:37
frommi19-Feb-09 3:37 
AnswerRe: Get Window Thread ProcessId Pin
Calin Tatar19-Feb-09 4:49
Calin Tatar19-Feb-09 4:49 
GeneralRe: Get Window Thread ProcessId Pin
frommi19-Feb-09 4:57
frommi19-Feb-09 4:57 
GeneralRe: Get Window Thread ProcessId Pin
Calin Tatar19-Feb-09 5:07
Calin Tatar19-Feb-09 5:07 
GeneralRe: Get Window Thread ProcessId Pin
frommi20-Feb-09 3:17
frommi20-Feb-09 3:17 
AnswerRe: Get Window Thread ProcessId Pin
Giorgi Dalakishvili19-Feb-09 5:55
mentorGiorgi Dalakishvili19-Feb-09 5:55 
Question[Message Deleted] Pin
musefan19-Feb-09 3:09
musefan19-Feb-09 3:09 
AnswerRe: SQL Query Issue Pin
J4amieC19-Feb-09 3:28
J4amieC19-Feb-09 3:28 
Questionpasting data in datagridview possible..? Pin
Mubeen.asim19-Feb-09 2:54
Mubeen.asim19-Feb-09 2:54 
Questionhow to use treeview tool in C#.net? Pin
poonam jagdale19-Feb-09 2:46
poonam jagdale19-Feb-09 2:46 
AnswerRe: how to use treeview tool in C#.net? Pin
Calin Tatar19-Feb-09 3:05
Calin Tatar19-Feb-09 3:05 
Questionconnectivity with remote server Pin
Digubha19-Feb-09 2:41
Digubha19-Feb-09 2:41 
AnswerRe: connectivity with remote server Pin
poonam jagdale19-Feb-09 2:51
poonam jagdale19-Feb-09 2:51 
AnswerRe: connectivity with remote server Pin
Mubeen.asim19-Feb-09 2:56
Mubeen.asim19-Feb-09 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.