You have to know exactly what type that your draggedObject
is before you can use any of its members. If you have created generic drag and drop functionality, then you need to add a property of type Type
that will specify, maybe even validate what type of data is being dragged. If for instance, you knew that your draggedObject
was of type Address
, then you could simply cast it and then use the properties like this:
object draggedItem = e.Data.GetData(this.format.Name);
Address draggedAddress = (Address)draggedItem;
DoSomethingWith(draggedAddress.PostCode);