Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fast way for finding GUIDs

Tags:

c#

.net

guid

I have lots(+2000) of GUIDs(in some network class) and my program must find one of them when it receives a message and do the job associated with it.
the positive point is i have a hard-code generator, but the fastest way is my goal(and i don't know how to implement it).

my code should do something like this:

switch(received guid)  
{  
case guid1: do job 1; break;  
case guid2: do job 2; break;  
case guid3: do job 3; break;  
case guid4: do job 4; break;  
....  
}  
like image 534
Behrooz Avatar asked Nov 28 '22 01:11

Behrooz


1 Answers

You could create a Dictionary with the Guid as the key and a delegate reference as the value. That would ensure fast lookups.

like image 57
Brian Rasmussen Avatar answered Dec 06 '22 00:12

Brian Rasmussen