For C #, the Enumerable.Sum<TSource> Method (IEnumerable<TSource>, Func<TSource, Int64>) does not support the ulong type as the return type of Mehtonf unless I overlaid ulong on long .
public class A { public ulong id {get;set;} } publec Class B { public void SomeMethod(IList<A> listOfA) { ulong result = listofA.Sum(A => A.Id); } }
The compiler would have performed two errors:


if i don't
ulong result = (ulong)listOfA.Sum(A => (long)A.Id)
Is there any way to solve this without casting? Thanks!
source share