Click or drag to resize

IUserBuilderCanMakeAttributePrivateAsPrivateAttribute Method

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.

Namespace:  LaunchDarkly.Client
Assembly:  LaunchDarkly.CommonSdk (in LaunchDarkly.CommonSdk.dll) Version: 2.11.0
Syntax
IUserBuilder AsPrivateAttribute()

Return Value

Type: 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 PrivateAttributeNames and AllAttributesPrivate.

Not all attributes can be made private: Key(String), SecondaryKey(String), and Anonymous(Boolean) 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() or User.Builder("user-key").SecondaryKey("secondary").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();
See Also