public Matrix this[Prototype prototype] { get{ if (prototypesMatrices.TryGetValue(prototype, out Matrix matrix)) { return(matrix); } else { return(null); } } set{ if (value.rect != rect) { throw new System.Exception("Trying to add a matrix of different resolution"); } if (prototypesMatrices.ContainsKey(prototype)) { prototypesMatrices[prototype] = value; } else { prototypesMatrices.Add(prototype, value); } } }
public void CanRemove() { DictionaryOrdered <string, string> dict = CreateDefault(); dict.Remove("3"); bool containsKey = dict.ContainsKey("3"); int ndx = dict.IndexOfKey("3"); string valAtIndex = dict[2]; Assert.IsFalse(containsKey); Assert.AreEqual(-1, ndx); Assert.AreEqual("d", valAtIndex); }
/// <summary> /// Get the named logger using the string indexer. /// </summary> /// <param name="name"></param> /// <returns></returns> public static ILogMulti Get(string name) { ILogMulti logger = null; ExecuteRead(() => { if (!_loggers.ContainsKey(name)) { return; } logger = _loggers[name]; }); return(logger); }
/// <summary> /// Get a logger by it's name. /// </summary> /// <param name="logger"></param> public override ILog this[string loggerName] { get { ILog logger = null; ExecuteRead(() => { if (!_loggers.ContainsKey(loggerName)) { return; } logger = _loggers[loggerName]; }); return(logger); } }