event field is a keyword in c#

Issue No. 243

Type

Improvement

Status

Open

Reported By

Julian Marshall

Component

API

Votes

0

Created

25/Jan/17 9:51 AM EST

Tracking

Sign in to track this issue

Description

Hi Amazing API! Thank you. Minor issue as there is an easy work around. The Events endpoint point has a top level return field called 'event'. In c# it is common to use deserialize the return stream to a 'dynamic' type. It is then easy to access the stream as it is strongly typed. However, in c# 'event' is a keyword. this means if we call MydynamicType.event we get a compile time error. As the field is on the top level I has issues with decorating it to another name, as I created the Event class. Decorators can only be used on Methods etc not classes. An example would make it easier to understand: dynamic x = Newtonsoft.Json.JsonConvert.DeserializeObject(eventsString); List<Event> events = x.GetValue("event"); This is common practice but fails as event is a c# keyword solution is to use : var events = x.GetValue("event").ToObject<List<Event>>(); I only mention this as it may catch out a few developers. Thx Julian