Это два различных способа бросить e. Пункт
к GridDataItem
, в зависимости от того, как вы хотите сценарий где e. Пунктом
не является GridDataItem
, чтобы быть обработанным.
In the first case, using as
: you will always get a result, but if e.Item
is not a GridDataItem
that result will be null
.
In the second case, using an explicit cast: if e.Item
is not a GridDataItem
, then your code will throw an InvalidCastException
(which you can catch).