¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

NewtonSoft Problem


 

I'm trying to convert some JSON into a series of C# classes.? My problem is that one of the classes is named Event and this is causing a conflict with SimplWindows because that name is already used.? I know that NewtonSoft allows you to use JsonProperty to perform a renaming of an element of a class to avoid a similar conflict but I can't find anything that will solve this problem for a class.

ERROR? (LGSPLS1000)?? 'Event' already defined

??? public class Root
??? {
??????? public int id { get; set; }
??????? public string type { get; set; }
??????? public Event @event { get; set; }

??? }

??? public class Event
??? {
??????? public string event_type { get; set; }
??????? public DateTime time_fired { get; set; }
??????? public string origin { get; set; }
??? }

Thanks in advance for the help

Jay

Join [email protected] to automatically receive all group messages.