var message = new TransportMessage(); message.Headers.Add("MessageType", "OrderPlaced"); message.Payload = Encoding.UTF8.GetBytes("{'orderId': '12345', 'amount': 500}");
var messageType = message.Headers["MessageType"]; var order = JsonConvert.DeserializeObjectIn this example, we are retrieving the value of the "MessageType" header and deserializing the payload from a JSON string into an Order object. Overall, the TransportMessage class in the MessageBus package library provides a convenient way to handle messages being transported through a messaging system in a C# application.(Encoding.UTF8.GetString(message.Payload));