Dynamic Linq Library Help
Posted
by Alon
on Stack Overflow
See other posts from Stack Overflow
or by Alon
Published on 2010-03-28T14:16:19Z
Indexed on
2010/03/28
14:23 UTC
Read the original article
Hit count: 386
Hi, I have the following class:
public class Item
{
public Dictionary<string, string> Data
{
get;
set;
}
}
and a list of it:
List<Item> items;
I need to filter and order this list dynamicly using SQL-Like strings. The catch is, that I need to order it by the Data dictionary.
For example: Order By Data["lastname"]
or Where Data["Name"].StartsWith("a")
. I thought to use the dynamic linq library, but is there any way that my clients can write without the Data[]? For example:
Name.StartsWith("abc")
instead of
Data["Name"].StartsWith("abc")
?
Thank you.
© Stack Overflow or respective owner