MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
DictionaryEx.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace MyCaffe.common
7{
8#pragma warning disable 1591
9
10 public class DictionaryEx<TKey, TValue> : Dictionary<TKey, TValue>
11 {
12 TValue m_tDefault;
13
14 public DictionaryEx(TValue tDefault)
15 : base()
16 {
17 m_tDefault = tDefault;
18 }
19
20 public new TValue this[TKey k]
21 {
22 get
23 {
24 if (!Keys.Contains(k))
25 Add(k, m_tDefault);
26
27 return base[k];
28 }
29 set
30 {
31 if (!Keys.Contains(k))
32 Add(k, value);
33 else
34 base[k] = value;
35 }
36 }
37 }
38
39#pragma warning restore 1591
40}
The MyCaffe.common namespace contains common MyCaffe classes.
Definition: BatchInput.cs:8