Fast find object by string property
Posted
by Andrew Kalashnikov
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Kalashnikov
Published on 2010-05-27T07:55:15Z
Indexed on
2010/05/27
8:01 UTC
Read the original article
Hit count: 212
Hello, colleagues. I've got task to fast find object by its string property. Object:
class DicDomain
{
public virtual string Id{ get; set; }
public virtual string Name { get; set; }
}
For storing my object I use List[T] dictionary where T is DicDomain for now . I've got 5-10 such lists, which contain about 500-20000 at each one. Task is find objects by its Name. I use next code now:
List<T> entities = dictionary.FindAll(s => s.Name.Equals(word, StringComparison.OrdinalIgnoreCase));
I've got some questions:
Is my search speed optimal. I think now.
- Data structure. It List good for this task. What about hashtable,sorted...
- Method Find. May be i should use string intern??
I haven't much exp at these tasks. Can u give me good advice for increase perfomance. Thanks
© Stack Overflow or respective owner