,
This commit is contained in:
parent
75c7be6da3
commit
3a938f6349
@ -119,7 +119,7 @@ where T : class
|
|||||||
{
|
{
|
||||||
throw new PositionOutOfCollectionException(position);
|
throw new PositionOutOfCollectionException(position);
|
||||||
}
|
}
|
||||||
if (_collection[position] == null) throw new ObjectNotFoundException(position);
|
if (_collection[position] == null) throw new ObjectNotFoundException(position);//выброс1
|
||||||
T obj = _collection[position];
|
T obj = _collection[position];
|
||||||
_collection[position] = null;
|
_collection[position] = null;
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -9,7 +9,7 @@ namespace ProjectAiroplane.Exceptions;
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
internal class ObjectNotFoundException : ApplicationException
|
internal class ObjectNotFoundException : ApplicationException
|
||||||
{
|
{
|
||||||
public ObjectNotFoundException(int i) : base("Не найден объект по позиции " + i) { }
|
public ObjectNotFoundException(int i) : base("Не найден объект по позиции " + i) { }//обработка1
|
||||||
|
|
||||||
public ObjectNotFoundException() : base() { }
|
public ObjectNotFoundException() : base() { }
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public partial class FormPlaneCollection : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (ObjectNotFoundException) { MessageBox.Show("Не удалось добавить объект");
|
catch (ObjectNotFoundException) { MessageBox.Show("Не удалось добавить объект");//ловлю ошибку1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user