Ejemplo n.º 1
0
    private static IDictionary <string, object> ExpandoGroupBy <T>(T x, string[] columnsToGroup) where T : class
    {
        var groupByColumns = new System.Dynamic.ExpandoObject() as IDictionary <string, object>;

        groupByColumns.Clear();
        foreach (string column in columnsToGroup)
        {
            groupByColumns.Add(column, typeof(T).GetProperty(column).GetValue(x, null));
        }
        return(groupByColumns);
    }