Project Description
This library helps you to create lists with large amount of data and do high speed searches on your data.

You can add index to your generic list, then find your items very fast.
you can see differences between search in standard .Net Generic List and IndexedList in the below image :
demo.jpg

Lets start with an example.
Assuming that we have a Person object like below :
    public class Person
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public string Family { get; set; }
        public string NationalNo { get; set; }
        public DateTime BirthDate { get; set; }
    }


we want to have 100,000 instances of person on memory and do frequent searches on Id and Name+Family fields, if you use simple list (List<Person>) it takes many time to do these searches, instead you can use IndexedList<Person> and add indexes on the fields like below :

IIndexedList<Person> personIndexedList = new IndexedList<Person>();

personIndexedList.AddUniqueIndex(p => p.Id);
personIndexedList.AddIndex(p => new { p.Name, p.Family });


then you can do search in 3 ways :
1) By Expression :
personIndexedList.FindSingle(p => p.Id == 10001);
personIndexedList.Find(p => p.Name == "Jack" && p.Family == "Alex");


2) By passing IndexName and a sample Object:
You can provide index names in AddIndex/AddUniqueIndex methods and use them in search, or you can use default indexnames (Field names separated by "_" )
personIndexedList.FindSingleUsingIndex("Id", new Person() { Id = 10001 });
personIndexedList.FindUsingIndex("Name_Family", new Person() { Name = "Jack", Family = "Alex" });


3) By passing just values (they should be ordered as they used in AddIndex):
personIndexedList.FindSingle((long)10001);
personIndexedList.Find("Jack", "Alex");


3) By passing IndexName and values (they should be ordered as they used in AddIndex):
personIndexedList.FindSingleUsingIndex("Id", (long)10001);
personIndexedList.FindUsingIndex("Name_Family", "Jack", "Alex");

Last edited Feb 17, 2015 at 12:15 PM by Basir_ansary, version 8