I have the following class:
public class ViewEvent {
public long Elapsed { get; private set; }
public string Description { get; private set; }
}
In my model I have a collection of instances of these classes:
public IList<ViewEvent> Events { get; set; }
How can I get the total elapsedTime of all the ViewEvents in my Events collection?
With LINQ,
Events.Sum(event => event.Elapsed);.As pointed out by Habib, be sure to add