Class FieldCodec<T> (3.27.1)

 public sealed class FieldCodec<T> 

An encode/decode pair for a single field. This effectively encapsulates all the information needed to read or write the field value from/to a coded stream.

This class is public and has to be as it is used by generated code, but its public API is very limited - just what the generated code needs to call directly.

Inheritance

object > FieldCodec<T>

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Type Parameter

Name
Description
T

Remarks

This never writes default values to the stream, and does not address "packedness" in repeated fields itself, other than to know whether or not the field should be packed.

Methods

CalculateSizeWithTag(T)

 public int CalculateSizeWithTag(T value) 

Calculates the size required to write the given value, with a tag, if the value is not the default.

Parameter
Name
Description
value
T
Returns
Type
Description
int

Read(CodedInputStream)

 public T Read(CodedInputStream input) 

Reads a value of the codec type from the given CodedInputStream .

Parameter
Name
Description
input
CodedInputStream

The input stream to read from.

Returns
Type
Description
T

The value read from the stream.

Read(ref ParseContext)

 public T Read(ref ParseContext ctx) 

Reads a value of the codec type from the given ParseContext .

Parameter
Name
Description
ctx
ParseContext

The parse context to read from.

Returns
Type
Description
T

The value read.

WriteTagAndValue(CodedOutputStream, T)

 public void WriteTagAndValue(CodedOutputStream output, T value) 

Write a tag and the given value, if the value is not the default.

Parameters
Name
Description
value
T

WriteTagAndValue(ref WriteContext, T)

 public void WriteTagAndValue(ref WriteContext ctx, T value) 

Write a tag and the given value, if the value is not the default.

Parameters
Name
Description
value
T
Design a Mobile Site
View Site in Mobile | Classic
Share by: