/// <summary> /// Initializes a new instance of the MessageSerializer class. /// </summary> /// <param name="messageType">The specific <see cref="IMessage"/>-derived type /// that will be serialized and deserialized using this class.</param> private MessageSerializer(Type messageType) { RequiresEx.NotNullSubtype <IMessage>(messageType, "messageType"); this.messageType = messageType; }
/// <summary> /// Creates or reuses a message serializer for a given message type. /// </summary> /// <param name="messageType">The type of message that will be serialized/deserialized.</param> /// <returns>A message serializer for the given message type.</returns> internal static MessageSerializer Get(Type messageType) { RequiresEx.NotNullSubtype <IMessage>(messageType, "messageType"); return(new MessageSerializer(messageType)); }