//------------------------------------------------------------------------------ // // Method: SerializeAndSend // //------------------------------------------------------------------------------ /// <summary> /// Provides common method invocation serialization and sending functionality to public methods. /// </summary> /// <param name="inputMethodInvocation">The method invocation to serialize and send.</param> /// <returns>The serialized return value of the method invocation.</returns> private string SerializeAndSend(IMethodInvocation inputMethodInvocation) { try { string serializedMethodInvocation = serializer.Serialize(inputMethodInvocation); sender.Send(serializedMethodInvocation); return(receiver.Receive()); } catch (Exception e) { throw new Exception("Failed to invoke method.", e); } }