Created
April 14, 2020 07:24
-
-
Save hatsunea/c5a222e9d0cc7b84008a1a0005f03f39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mes = new TObs() | |
{ | |
messageid = Guid.NewGuid().ToString(), | |
source = this.SourceName, | |
status = "OK", | |
}; | |
var options = MessagePack.MessagePackSerializerOptions.Standard.WithResolver(MessagePack.Resolvers.StandardResolverAllowPrivate.Instance); | |
var jsonString = MessagePack.MessagePackSerializer.ConvertToJson(MessagePack.MessagePackSerializer.Serialize<TObs>(mes, options)); | |
[MessagePack.MessagePackObject(true)] | |
private class TObs | |
{ | |
public string error { get; set; } | |
public string messageid { get; set; } | |
public string status { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment