Hi all - Just trying to get to grips with the newi...
# announcements
s
Hi all - Just trying to get to grips with the newish C# SDK - I'm struggling to populate the features dictionary in Context with the API response JSON. Does anyone have a code snippet that could help, there doesn't appear to be any documentation ?
f
@proud-family-69484 might be able to help you
s
I worked it out... var httpClient = new HttpClient(); var response = await httpClient.GetAsync("https://cdn.growthbook.io/api/features/MY_KEY"); if (response.IsSuccessStatusCode) { var featuresResp = JObject.Parse(await response.Content.ReadAsStringAsync()); var features = featuresResp["features"]; // Create and populate the context object var context = new GrowthBook.Context(); context.Features = features.Cast<JProperty>() .ToDictionary(item => item.Name, item => item.Value.ToObject<Feature>()); }