Interface IUserBuilderCanMakeAttributePrivate
An extension of IUserBuilder that allows attributes to be made private via the AsPrivateAttribute() method.
Inherited Members
Namespace: LaunchDarkly.Sdk
Assembly: LaunchDarkly.CommonSdk.dll
Syntax
public interface IUserBuilderCanMakeAttributePrivate : IUserBuilder
Remarks
IUserBuilder setter methods for attribute that can be made private always return this interface, rather than returning IUserBuilder. See AsPrivateAttribute() for more details.
Methods
AsPrivateAttribute()
Marks the last attribute that was set on this builder as being a private attribute: that is, its value will not be sent to LaunchDarkly.
Declaration
IUserBuilder AsPrivateAttribute()
Returns
Type | Description |
---|---|
IUserBuilder | the same builder |
Remarks
This action only affects analytics events that are generated by this particular user object. To mark some (or all)
user attributes as private for all users, use the configuration properties PrivateAttributeName
and AllAttributesPrivate
.
Not all attributes can be made private: Key(string) and Anonymous(bool)
cannot be private. This is enforced by the compiler, since the builder methods for attributes that can be made private are
the only ones that return IUserBuilderCanMakeAttributePrivate; therefore, you cannot write an expression
like User.Builder("user-key").AsPrivateAttribute()
.
Examples
In this example, FirstName
and LastName
are marked as private, but Country
is not.
var user = User.Builder("user-key")
.FirstName("Pierre").AsPrivateAttribute()
.LastName("Menard").AsPrivateAttribute()
.Country("ES")
.Build();