예제 #1
0
        private static EventBase TranslateJson(string json)
        {
            var jsonDocument = JsonDocument.Parse(json);
            var type         = EventBase.EventTypeEnumToType(
                (EventType)jsonDocument.RootElement
                .EnumerateObject()
                .First(x => x.NameEquals(nameof(EventBase.Type)))
                .Value.GetInt32());

            return((EventBase)JsonSerializer.Deserialize(json, type));
        }