Esempio n. 1
0
 public int this[int xCoordinate, int yCoordinate]
 {
     get
     {
         CheckIndex(xCoordinate, yCoordinate);
         var item = from i in items
                    where (i.XCoordinate == xCoordinate && i.YCoordinate == yCoordinate)
                    select i.Value;
         if (item.Count() == 0)
         {
             throw new Exception($"Не найден элемент с таким индексом [{xCoordinate},{yCoordinate}]");
         }
         else
         {
             return(item.ToList <int>()[0]);
         }
     }
     set
     {
         CheckIndex(xCoordinate, yCoordinate);
         for (int count = 0; count < items.Count; count++)
         {
             MatrixItem i = items[count];
             if (i.XCoordinate == xCoordinate && i.YCoordinate == yCoordinate)
             {
                 i.Value = value;
             }
         }
     }
 }
Esempio n. 2
0
        public int CompareTo(object obj)
        {
            MatrixItem item = obj as MatrixItem;

            return(this.Value.CompareTo(item.Value));
        }