Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Rextester
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- ExtendedDictionary<int> dic = new ExtendedDictionary<int>();
- dic.Insert(1, "lala");
- dic.Insert(2, "dydy");
- int zm = dic.Suum();
- Console.WriteLine(zm);
- }
- }
- public class ExtendedDictionary<T> where T :
- {
- private Dictionary<T, string> items;
- private int sum ;
- // public int Sum{ get { return sum;} }
- // public int Sum{ get; set;}
- public ExtendedDictionary()
- {
- items = new Dictionary<T, string>();
- }
- public void Insert(T key, string valuee)
- {
- items.Add(key, valuee );
- }
- public void Delete(T key)
- {
- items.Remove(key);
- }
- public int Suum()
- {
- return items.Sum(e => e.Value.Length);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement