Esempio n. 1
0
 /// <summary>
 /// Get the value at the specified position
 /// </summary>
 /// <param name="x">X coordinate of the value</param>
 /// <param name="y">Y coordinate of the value</param>
 /// <returns>The value at the specified position</returns>
 public T this[int x, int y]
 {
     get
     {
         var key = new Position2I(x, y);
         if (!_list.ContainsKey(key))
         {
             return(Default);
         }
         return(_list[key]);
     }
     set
     {
         var  key       = new Position2I(x, y);
         bool isDefault = IsDefault(value);
         if (isDefault)
         {
             if (_list.ContainsKey(key))
             {
                 _list.Remove(key);
             }
         }
         else
         {
             _list[key] = value;
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Get the value at the specified position
 /// </summary>
 /// <param name="pos">Position of the value</param>
 /// <returns>The value at the specified position</returns>
 public T this[Position2I pos] => this[pos.X, pos.Y];