Yes, IEnumerable
will do linear search with O(n) complexity. There is unlikely to be measurable difference between filed, property or method call returning a string (make sure to measure if actually important).
If you need lookup that is faster - dictionary is the better choice with O(1) lookup.
Notes
- if you are querying DB with Linq-to-SQL such property access will be translated into SQL query and likely be optimized by SQL to be close to O(1) on indexed fields.
- property is a method - so automatic property and method directly returning backing filed should have the same performance. In your sample you have method that returns value of property that in turn returns value of backing field which may cause some difference, but there is good chance that both calls will be inlined by JIT anyway.
- you can implement your own IQueryable source to provide optimized search/where methods and get queries compiled into Queryable extension calls instead of
Enumerable
ones.