I am trying to find an efficient way to build a cross reference in C# and I am at a loss so I thought I would ask for ideas. I have tried using a list view, concatenating the source and associated values into a single dimension array, and several other things. My problem is the list of source values is dynamic and can be quite large and everything I have tried has had performance issues.
The only requirements I have are
1) It is must be a memory option because I don't have a database in this program.
2) I can't add a source value multiple times.
3) I need to be able to retrieve the associated value later in the program.
So I don't disclose the true nature of my program, I am going to provide a ficticiuos example.
As I read a file, I need to process each letter by first seeing if it is already in the list and if not, add it and the next available number.
"this is sample data" cross references to t=1, h=2, i=3, s=4, a=5, m=6, p=7, l=8, e=9, d=10
Now I also need to be able to search for a letter such as p to retrieve the cross reference value of 7.
I will disclose that the source values are 3 dimensions coordinates (x, y, z) and there can easily be 200K+ values (many of which are duplicates) so sorting and retrieving values is not as simple as the example makes it look.
Maybe the nature of what I am trying to do will always have performance issues but I am hoping someone comes up with something that I don't know about (I'm not a C# newbie but there still are a lot of thing I don't know about) or a different way of doing it so it doesn't have performance issues.