This question is locked. New answers and comments are not allowed.
I am attempting to write a custom aggregator to sum TimeSpan values. I kept getting the "No generic method" error so I scoured these forums and pulled down a couple of simple projects to play with. But I'm getting the same error, "No generic method 'Sum' on type 'CustomAggregateFunctionSL.MyAggregates' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic."
Here is a small snippet showing what I'm doing in the page.
And here is the code for the custom aggregator.
What am I doing wrong? I am using 2011.3.1116.1040.
Here is a small snippet showing what I'm doing in the page.
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); List<Item> items = new List<Item>(); for (int i = 0; i < 10; i++) { items.Add(new Item(){ Value1 = TimeSpan.FromSeconds(i), Type=(i%2==0?"P":"Q")}); } this.RadGridView1.ItemsSource = items; this.RadGridView1.Columns[0].AggregateFunctions.Add(new MyAggregateFunction() { Caption = "Sum of Time's" }); } } public class Item { public TimeSpan Value1 { get; set; } public String Type{ get; set; } }And here is the code for the custom aggregator.
public class MyAggregateFunction : EnumerableAggregateFunction { protected override string AggregateMethodName { get { return "Sum"; } } protected override Type ExtensionMethodsType { get { return typeof(MyAggregates); } } } public class MyAggregates { public static TimeSpan Sum<TSource>(IEnumerable<TSource> source, Func<TSource, TimeSpan> selector) { return source.Select(selector).Aggregate(TimeSpan.Zero, (t1, t2) => t1 + t2); } }What am I doing wrong? I am using 2011.3.1116.1040.