Class Value

Stay organized with collections Save and categorize content based on your preferences.
public sealed class Value : object, IMessage<Value>, IEquatable<Value>, IDeepCloneable<Value>, IBufferMessage, IMessage

Value represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of that variants, absence of any variant indicates an error.

The JSON representation for Value is JSON value.

Inheritance

Object > Value

Namespace

Google.Protobuf.WellKnownTypes

Assembly

Google.Protobuf.dll

Constructors

Value()

public Value()

Value(Value)

public Value(Value other)
Parameter
TypeNameDescription
Valueother

Fields

BoolValueFieldNumber

public const int BoolValueFieldNumber = null

Field number for the "bool_value" field.

Field Value
TypeDescription
Int32

ListValueFieldNumber

public const int ListValueFieldNumber = null

Field number for the "list_value" field.

Field Value
TypeDescription
Int32

NullValueFieldNumber

public const int NullValueFieldNumber = null

Field number for the "null_value" field.

Field Value
TypeDescription
Int32

NumberValueFieldNumber

public const int NumberValueFieldNumber = null

Field number for the "number_value" field.

Field Value
TypeDescription
Int32

StringValueFieldNumber

public const int StringValueFieldNumber = null

Field number for the "string_value" field.

Field Value
TypeDescription
Int32

StructValueFieldNumber

public const int StructValueFieldNumber = null

Field number for the "struct_value" field.

Field Value
TypeDescription
Int32

Properties

BoolValue

public bool BoolValue { get; set; }

Represents a boolean value.

Property Value
TypeDescription
Boolean

Descriptor

public static MessageDescriptor Descriptor { get; }
Property Value
TypeDescription
MessageDescriptor

KindCase

public Value.KindOneofCase KindCase { get; }
Property Value
TypeDescription
Value.KindOneofCase

ListValue

public ListValue ListValue { get; set; }

Represents a repeated Value.

Property Value
TypeDescription
ListValue

NullValue

public NullValue NullValue { get; set; }

Represents a null value.

Property Value
TypeDescription
NullValue

NumberValue

public double NumberValue { get; set; }

Represents a double value.

Property Value
TypeDescription
Double

Parser

public static MessageParser<Value> Parser { get; }
Property Value
TypeDescription
MessageParser<Value>

StringValue

public string StringValue { get; set; }

Represents a string value.

Property Value
TypeDescription
String

StructValue

public Struct StructValue { get; set; }

Represents a structured value.

Property Value
TypeDescription
Struct

Methods

CalculateSize()

public int CalculateSize()
Returns
TypeDescription
Int32

ClearKind()

public void ClearKind()

Clone()

public Value Clone()
Returns
TypeDescription
Value

Equals(Value)

public bool Equals(Value other)
Parameter
TypeNameDescription
Valueother
Returns
TypeDescription
Boolean

Equals(Object)

public override bool Equals(object other)
Parameter
TypeNameDescription
Objectother
Returns
TypeDescription
Boolean

ForBool(Boolean)

public static Value ForBool(bool value)

Convenience method to create a Value message with a Boolean value.

Parameter
TypeNameDescription
Booleanvalue

Value to set for the BoolValue property.

Returns
TypeDescription
Value

A newly-created Value message with the given value.

ForList(Value[])

public static Value ForList(params Value[] values)

Convenience method to create a Value message with an initial list of values.

Parameter
TypeNameDescription
Value[]values
Returns
TypeDescription
Value

A newly-created Value message an initial list value.

Remarks

The values provided are not cloned; the references are copied directly.

ForNull()

public static Value ForNull()

Convenience method to create a Value message with a null initial value.

Returns
TypeDescription
Value

A newly-created Value message a null initial value.

ForNumber(Double)

public static Value ForNumber(double value)

Convenience method to create a Value message with a number value.

Parameter
TypeNameDescription
Doublevalue

Value to set for the NumberValue property.

Returns
TypeDescription
Value

A newly-created Value message with the given value.

ForString(String)

public static Value ForString(string value)

Convenience method to create a Value message with a string value.

Parameter
TypeNameDescription
Stringvalue

Value to set for the StringValue property.

Returns
TypeDescription
Value

A newly-created Value message with the given value.

ForStruct(Struct)

public static Value ForStruct(Struct value)

Convenience method to create a Value message with an initial struct value

Parameter
TypeNameDescription
Structvalue
Returns
TypeDescription
Value

A newly-created Value message an initial struct value.

Remarks

The value provided is not cloned; the reference is copied directly.

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32

MergeFrom(CodedInputStream)

public void MergeFrom(CodedInputStream input)
Parameter
TypeNameDescription
CodedInputStreaminput

MergeFrom(Value)

public void MergeFrom(Value other)
Parameter
TypeNameDescription
Valueother

ToString()

public override string ToString()
Returns
TypeDescription
String

WriteTo(CodedOutputStream)

public void WriteTo(CodedOutputStream output)
Parameter
TypeNameDescription
CodedOutputStreamoutput

Explicit Interface Implementations

IBufferMessage.InternalMergeFrom(ref ParseContext)

void IBufferMessage.InternalMergeFrom(ref ParseContext input)
Parameter
TypeNameDescription
ParseContextinput

IBufferMessage.InternalWriteTo(ref WriteContext)

void IBufferMessage.InternalWriteTo(ref WriteContext output)
Parameter
TypeNameDescription
WriteContextoutput

IMessage.Descriptor

MessageDescriptor IMessage.Descriptor { get; }
Returns
TypeDescription
MessageDescriptor

Implements

IEquatable<>