MCPcopy Create free account
hub / github.com/apache/fory / WriteData

Method WriteData

csharp/src/Fory/EnumSerializer.cs:27–36  ·  view source on GitHub ↗
(WriteContext context, in TEnum value, bool hasGenerics)

Source from the content-addressed store, hash-verified

25 public override TEnum DefaultValue => default;
26
27 public override void WriteData(WriteContext context, in TEnum value, bool hasGenerics)
28 {
29 _ = hasGenerics;
30 if (!DefinedValueToOrdinal.TryGetValue(value, out uint ordinal))
31 {
32 ordinal = Convert.ToUInt32(value);
33 }
34
35 context.Writer.WriteVarUInt32(ordinal);
36 }
37
38 public override TEnum ReadData(ReadContext context)
39 {

Callers

nothing calls this directly

Calls 3

ToUInt32Method · 0.80
WriteVarUInt32Method · 0.80
TryGetValueMethod · 0.45

Tested by

no test coverage detected