This is an extension method to help a user in processing a DragEventArgs to a object type of their choice.

How

  • Take a function to create the required Type from a FileStream.
  • Take an Action to handle an exception.
  • Check that the drop array contains a FileDrop.
  • Select the First FileInfo and open a FileStream.
  • Execute createAction with this FileStream. If this fails the exception will be handled by the onFailed callback.

The Code: