<PackageReference Include="Google.Protobuf" Version="3.34.1" />

Google.Protobuf.FieldCodec

public static class FieldCodec
Factory methods for FieldCodec<T>.
public static FieldCodec<bool> ForBool(uint tag)

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

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

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

public static FieldCodec<ByteString> ForBytes(uint tag)

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

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

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

public static FieldCodec<T> ForClassWrapper<T>(uint tag)

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

public static FieldCodec<double> ForDouble(uint tag)

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

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

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

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.

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.

public static FieldCodec<uint> ForFixed32(uint tag)

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

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

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

public static FieldCodec<ulong> ForFixed64(uint tag)

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

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

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

public static FieldCodec<float> ForFloat(uint tag)

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

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

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

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

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

public static FieldCodec<int> ForInt32(uint tag)

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

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

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

public static FieldCodec<long> ForInt64(uint tag)

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

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

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

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

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

public static FieldCodec<int> ForSFixed32(uint tag)

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

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

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

public static FieldCodec<long> ForSFixed64(uint tag)

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

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

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

public static FieldCodec<int> ForSInt32(uint tag)

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

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

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

public static FieldCodec<long> ForSInt64(uint tag)

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

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

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

public static FieldCodec<string> ForString(uint tag)

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

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

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

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.

public static FieldCodec<uint> ForUInt32(uint tag)

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

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

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

public static FieldCodec<ulong> ForUInt64(uint tag)

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

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

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