Cast a variable to a Type and call Methods
问题 How would I go about invoking a method call for an Object after casting it to a Type? I have a KeyValuePair which stores the type of the object and the object itself. I then want to cast this object to its key type and invoke a method of that class type. KeyValuePair<Type, Object> client = myClients.Find( delegate(KeyValuePair<Type, Object> result) { return (result.Key == myClients[clientNumber].Key); // Match client of the same type } ); if (client.Value != null) { // cast client.Value to