コード例 #1
0
 public float this[int index]
 {
     get
     {
         for (int j = 0; j < _keys.Length(); j++)
         {
             if (_keys.UnsafeAt1d(j) == index)
             {
                 return(_values[j]);
             }
         }
         _keys.Push(index);
         _values.Push(0f);
         if (index >= _len)
         {
             _len = index + 1;
         }
         return(_values.Last());
     }
     set
     {
         for (int j = 0; j < _keys.Length(); j++)
         {
             if (_keys.UnsafeAt1d(j) == index)
             {
                 _values[j] = value;
                 return;
             }
         }
         _keys.Push(index);
         _values.Push(value);
         if (index >= _len)
         {
             _len = index + 1;
         }
     }
 }