Publish an Event without PayLoad in Prism EventAggregator?

后端 未结 2 823
北海茫月
北海茫月 2021-02-19 20:47

Why can\'t we Publish Events without any PayLoad.

    _eventAggregator.GetEvent().Publish(new SelectFolderEventCriteria() { });
         


        
2条回答
  •  耶瑟儿~
    2021-02-19 21:30

    Just to update the situation since this question was asked/answered, as of Prism 6.2, empty payloads are now supported in Prism PubSubEvents.

    If you're using an older version, this blog shows how to create an "Empty" class that clearly indicates the intent of the payload: https://blog.davidpadbury.com/2010/01/01/empty-type-parameters/

提交回复
热议问题