Доступ к Аргументам События в блоке сценария Действия Регистра-ObjectEvent cmdlet

Если Вы не хотите использовать @SuppressWarnings ("снял флажок") с Вами, может сделать следующее.

   Query q = sess.createQuery("from Cat cat");
   List<?> results =(List<?>) q.list();
   List<Cat> cats = new ArrayList<Cat>();
   for(Object result:results) {
       Cat cat = (Cat) result;
       cats.add(cat);
    }

к вашему сведению - я создал util метод, который делает это для меня так, он не замусорил мой код, и я не должен использовать @SupressWarning.

8
задан tellingmachine 8 October 2009 в 20:46
поделиться

1 ответ

Yes. The EventArgs object is available inside the Action script block as a magical variable called $Event. This is what get-help Register-ObjectEvent -detail has to say:

From the MSDN documentation:

The value of the Action parameter can include the $Event, $EventSubscriber, $Sender, $SourceEventArgs, and $SourceArgs automatic variables, which provide information about the event to the Action script block. For more information, see about_Automatic_Variables.

8
ответ дан 5 December 2019 в 20:17
поделиться
Другие вопросы по тегам:

Похожие вопросы: