Created
August 31, 2011 09:03
-
-
Save eldewall/1183127 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ObjectCount { | |
| public Dictionary<int, int> Values { get; private set; } | |
| public ObjectCount(Dictionary<int, int> values) { | |
| this.Values = values; | |
| } | |
| public int Total { | |
| get { | |
| return Values.Sum(v => v.Value); | |
| } | |
| } | |
| public int this[int value] { | |
| get { | |
| try { | |
| return Values[value]; | |
| } | |
| catch (Exception) { | |
| return 0; | |
| } | |
| } | |
| } | |
| } | |
| Personbilar (@Model.ObjectCount[BBAdmin.Models.ObjectTypes.Car]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment