Show / Hide Table of Contents

Class ContextKind

A string value provided by the application to describe what kind of entity a Context represents.

Inheritance
System.Object
ContextKind
Implements
System.IEquatable<ContextKind>
Namespace: LaunchDarkly.Sdk
Assembly: LaunchDarkly.CommonSdk.dll
Syntax
public sealed class ContextKind : ValueType, IEquatable<ContextKind>
Remarks

The type is a simple wrapper for a string. Using a type that is not just string makes it clearer where a context kind is expected or returned in the SDK API, so it cannot be confused with other important strings such as Key. To convert a literal string to this type, you can use the shortcut Of(String).

The meaning of the context kind is completely up to the application. Validation rules are as follows:

  • It may only contain letters, numbers, and the characters ".", "_", and "-".
  • It cannot equal the literal string "kind".
  • For a single-kind context, it cannot equal "multi".

If no kind is specified, the default is "user" (the constant Default). However, an uninitialized struct (new ContextKind() is invalid and has a string value of "".

For a multi-kind Context (see NewMulti(Context[])), the kind of the top-level Context is always "multi" (the constant Multi); there is a specific Kind for each of the Contexts contained within it.

To learn more, read the documentation.

Constructors

ContextKind(String)

Constructor from a string value.

Declaration
public ContextKind(string stringValue)
Parameters
Type Name Description
System.String stringValue

the string value

Remarks

A value of null or "" will be changed to Default.

Fields

Default

A constant for the default kind of "user".

Declaration
public static readonly ContextKind Default
Field Value
Type Description
ContextKind

Multi

A constant for the kind that all multi-kind Contexts have.

Declaration
public static readonly ContextKind Multi
Field Value
Type Description
ContextKind

Properties

IsDefault

True if this is equal to Default ("user").

Declaration
public bool IsDefault { get; }
Property Value
Type Description
System.Boolean

Value

The string value of the context kind. This is never null.

Declaration
public string Value { get; }
Property Value
Type Description
System.String

Methods

Equals(ContextKind)

Declaration
public bool Equals(ContextKind other)
Parameters
Type Name Description
ContextKind other
Returns
Type Description
System.Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

Of(String)

Shortcut for calling the constructor.

Declaration
public static ContextKind Of(string stringValue)
Parameters
Type Name Description
System.String stringValue

the string value

Returns
Type Description
ContextKind

a ContextKind wrapping this value

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String

Operators

Equality(ContextKind, ContextKind)

Declaration
public static bool operator ==(ContextKind a, ContextKind b)
Parameters
Type Name Description
ContextKind a
ContextKind b
Returns
Type Description
System.Boolean

Inequality(ContextKind, ContextKind)

Declaration
public static bool operator !=(ContextKind a, ContextKind b)
Parameters
Type Name Description
ContextKind a
ContextKind b
Returns
Type Description
System.Boolean

Implements

System.IEquatable<>
In This Article
Back to top Generated by DocFX