Class FieldCodec (3.15.8)

 public static class FieldCodec : object 

Factory methods for FieldCodec<T> .

Inheritance

Object > FieldCodec

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Methods

ForBool(UInt32)

 public static FieldCodec<bool> ForBool(uint tag) 

Retrieves a codec suitable for a bool field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForBool(UInt32, Boolean)

 public static FieldCodec<bool> ForBool(uint tag, bool defaultValue) 

Retrieves a codec suitable for a bool field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Boolean

The default value.

Returns
Type
Description

A codec for the given tag.

ForBytes(UInt32)

 public static FieldCodec<ByteString> ForBytes(uint tag) 

Retrieves a codec suitable for a bytes field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForBytes(UInt32, ByteString)

 public static FieldCodec<ByteString> ForBytes(uint tag, ByteString defaultValue) 

Retrieves a codec suitable for a bytes field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
ByteString

The default value.

Returns
Type
Description

A codec for the given tag.

ForClassWrapper<T>(UInt32)

 public static FieldCodec<T> ForClassWrapper<T>(uint tag)
    where T : class 

Creates a codec for a wrapper type of a class - which must be string or ByteString.

Parameter
Name
Description
tag
Returns
Type
Description
Type Parameter
Name
Description
T

ForDouble(UInt32)

 public static FieldCodec<double> ForDouble(uint tag) 

Retrieves a codec suitable for a double field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForDouble(UInt32, Double)

 public static FieldCodec<double> ForDouble(uint tag, double defaultValue) 

Retrieves a codec suitable for a double field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Double

The default value.

Returns
Type
Description

A codec for the given tag.

ForEnum<T>(UInt32, Func<T, Int32>, Func<Int32, T>)

 public static FieldCodec<T> ForEnum<T>(uint tag, Func<T, int> toInt32, Func<int, T> fromInt32) 

Retrieves a codec suitable for an enum field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

toInt32
Func <T, Int32 >

A conversion function from to the enum type.

fromInt32
Func < Int32 , T>

A conversion function from the enum type to .

Returns
Type
Description

A codec for the given tag.

Type Parameter
Name
Description
T

ForEnum<T>(UInt32, Func<T, Int32>, Func<Int32, T>, T)

 public static FieldCodec<T> ForEnum<T>(uint tag, Func<T, int> toInt32, Func<int, T> fromInt32, T defaultValue) 

Retrieves a codec suitable for an enum field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

toInt32
Func <T, Int32 >

A conversion function from to the enum type.

fromInt32
Func < Int32 , T>

A conversion function from the enum type to .

defaultValue
T

The default value.

Returns
Type
Description

A codec for the given tag.

Type Parameter
Name
Description
T

ForFixed32(UInt32)

 public static FieldCodec<uint> ForFixed32(uint tag) 

Retrieves a codec suitable for a fixed32 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForFixed32(UInt32, UInt32)

 public static FieldCodec<uint> ForFixed32(uint tag, uint defaultValue) 

Retrieves a codec suitable for a fixed32 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
UInt32

The default value.

Returns
Type
Description

A codec for the given tag.

ForFixed64(UInt32)

 public static FieldCodec<ulong> ForFixed64(uint tag) 

Retrieves a codec suitable for a fixed64 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForFixed64(UInt32, UInt64)

 public static FieldCodec<ulong> ForFixed64(uint tag, ulong defaultValue) 

Retrieves a codec suitable for a fixed64 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
UInt64

The default value.

Returns
Type
Description

A codec for the given tag.

ForFloat(UInt32)

 public static FieldCodec<float> ForFloat(uint tag) 

Retrieves a codec suitable for a float field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForFloat(UInt32, Single)

 public static FieldCodec<float> ForFloat(uint tag, float defaultValue) 

Retrieves a codec suitable for a float field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Single

The default value.

Returns
Type
Description

A codec for the given tag.

ForGroup<T>(UInt32, UInt32, MessageParser<T>)

 public static FieldCodec<T> ForGroup<T>(uint startTag, uint endTag, MessageParser<T> parser)
    where T : class, IMessage<T> 

Retrieves a codec suitable for a group field with the given tag.

Parameters
Name
Description
startTag
UInt32

The start group tag.

endTag
UInt32

The end group tag.

parser
MessageParser <T>

A parser to use for the group message type.

Returns
Type
Description

A codec for given tag

Type Parameter
Name
Description
T

ForInt32(UInt32)

 public static FieldCodec<int> ForInt32(uint tag) 

Retrieves a codec suitable for an int32 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForInt32(UInt32, Int32)

 public static FieldCodec<int> ForInt32(uint tag, int defaultValue) 

Retrieves a codec suitable for an int32 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Int32

The default value.

Returns
Type
Description

A codec for the given tag.

ForInt64(UInt32)

 public static FieldCodec<long> ForInt64(uint tag) 

Retrieves a codec suitable for an int64 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForInt64(UInt32, Int64)

 public static FieldCodec<long> ForInt64(uint tag, long defaultValue) 

Retrieves a codec suitable for an int64 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Int64

The default value.

Returns
Type
Description

A codec for the given tag.

ForMessage<T>(UInt32, MessageParser<T>)

 public static FieldCodec<T> ForMessage<T>(uint tag, MessageParser<T> parser)
    where T : class, IMessage<T> 

Retrieves a codec suitable for a message field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

parser
MessageParser <T>

A parser to use for the message type.

Returns
Type
Description

A codec for the given tag.

Type Parameter
Name
Description
T

ForSFixed32(UInt32)

 public static FieldCodec<int> ForSFixed32(uint tag) 

Retrieves a codec suitable for an sfixed32 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForSFixed32(UInt32, Int32)

 public static FieldCodec<int> ForSFixed32(uint tag, int defaultValue) 

Retrieves a codec suitable for an sfixed32 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Int32

The default value.

Returns
Type
Description

A codec for the given tag.

ForSFixed64(UInt32)

 public static FieldCodec<long> ForSFixed64(uint tag) 

Retrieves a codec suitable for an sfixed64 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForSFixed64(UInt32, Int64)

 public static FieldCodec<long> ForSFixed64(uint tag, long defaultValue) 

Retrieves a codec suitable for an sfixed64 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Int64

The default value.

Returns
Type
Description

A codec for the given tag.

ForSInt32(UInt32)

 public static FieldCodec<int> ForSInt32(uint tag) 

Retrieves a codec suitable for an sint32 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForSInt32(UInt32, Int32)

 public static FieldCodec<int> ForSInt32(uint tag, int defaultValue) 

Retrieves a codec suitable for an sint32 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Int32

The default value.

Returns
Type
Description

A codec for the given tag.

ForSInt64(UInt32)

 public static FieldCodec<long> ForSInt64(uint tag) 

Retrieves a codec suitable for an sint64 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForSInt64(UInt32, Int64)

 public static FieldCodec<long> ForSInt64(uint tag, long defaultValue) 

Retrieves a codec suitable for an sint64 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
Int64

The default value.

Returns
Type
Description

A codec for the given tag.

ForString(UInt32)

 public static FieldCodec<string> ForString(uint tag) 

Retrieves a codec suitable for a string field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForString(UInt32, String)

 public static FieldCodec<string> ForString(uint tag, string defaultValue) 

Retrieves a codec suitable for a string field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
String

The default value.

Returns
Type
Description

A codec for the given tag.

ForStructWrapper<T>(UInt32)

 public static FieldCodec<T?> ForStructWrapper<T>(uint tag)
    where T : struct 

Creates a codec for a wrapper type of a struct - which must be Int32, Int64, UInt32, UInt64, Bool, Single or Double.

Parameter
Name
Description
tag
Returns
Type
Description
Type Parameter
Name
Description
T

ForUInt32(UInt32)

 public static FieldCodec<uint> ForUInt32(uint tag) 

Retrieves a codec suitable for a uint32 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForUInt32(UInt32, UInt32)

 public static FieldCodec<uint> ForUInt32(uint tag, uint defaultValue) 

Retrieves a codec suitable for a uint32 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
UInt32

The default value.

Returns
Type
Description

A codec for the given tag.

ForUInt64(UInt32)

 public static FieldCodec<ulong> ForUInt64(uint tag) 

Retrieves a codec suitable for a uint64 field with the given tag.

Parameter
Name
Description
tag
UInt32

The tag.

Returns
Type
Description

A codec for the given tag.

ForUInt64(UInt32, UInt64)

 public static FieldCodec<ulong> ForUInt64(uint tag, ulong defaultValue) 

Retrieves a codec suitable for a uint64 field with the given tag.

Parameters
Name
Description
tag
UInt32

The tag.

defaultValue
UInt64

The default value.

Returns
Type
Description

A codec for the given tag.

Create a Mobile Website
View Site in Mobile | Classic
Share by: