I'm working through the "Data Binding" chapter in Pro WPF in C# 2008.
They have you set up this class:
public class StoreDB
{
public Contact GetContact(int id) {...}
public List<Contact> GetContacts() {...}
}
The idea is to call these methods, getting either a Contact
or a List<Contact>
and bind these to the appropriate controls using LINQ on the latter method to filter/sort your objects.
This all makes sense.
However, what happens when you have 100,000 contacts and you want to get 3 of them? Your GetContacts()
method gets 100,000 and your LINQ picks out three of them?
Isn't this super inefficient?
How are real-world applications built to avoid this?