Hi, I am trying to implement it using C# SDK, but ...
# announcements
a
Hi, I am trying to implement it using C# SDK, but I am having issue with it's setter, prompting that the "Growthbook" does not contain the definition of "SetAttributes". Can someone help me on this? Thank you
1
b
hello, it looks like there isn't a
SetAttributes
method on the
GrowthBook
instance, but it looks like working with attributes is done in the
Context
. https://github.com/growthbook/growthbook-c-sharp/blob/main/GrowthBook/Context.cs#L23 It's been a while since i've used C# but my thoughts are, with the getters and setters defined, and it being public and there being no explicit constructor defined, that you can pass your JObject in when constructing the Context, and if not, assign it after the Context is created. let me know how this goes. I'll add a ticket for the maintainers to improve the documentation for the next time. try something like this:
Copy code
var attrs = new JObject();
attrs.Add("userid", "foo");

var gb = new GrowthBook.GrowthBook(
  new Context(
    Attributes = attrs,
    Features = featuresResult.Features,
  )
);
a
thank you Tina