https://www.growthbook.io/ logo
#announcements
Title
# announcements
a

adventurous-lamp-69236

06/27/2023, 4:44 PM
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

better-magician-65629

06/27/2023, 4:59 PM
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

adventurous-lamp-69236

06/29/2023, 8:18 AM
thank you Tina
16 Views