Skip to main content
Version: 1.5.0

Supported Types

This page summarizes built-in and generated type support in Apache Fory™ C#.

Primitive Types

C# TypeNotes
boolSupported
sbyte, short, int, longSupported
byte, ushort, uint, ulongSupported
float, doubleSupported
Half, BFloat16Supported
stringSupported
byte[]Supported
Nullable primitives (for example int?)Supported

Arrays

  • Primitive numeric arrays (bool[], int[], ulong[], etc.)
  • Half[], List<Half> with S.Array<S.Float16> for array<float16>
  • BFloat16[], List<BFloat16> with S.Array<S.BFloat16> for array<bfloat16>
  • byte[]
  • General arrays (T[]) through collection serializers

Collections

List-like

  • List<T>
  • LinkedList<T>
  • Queue<T>
  • Stack<T>

Set-like

  • HashSet<T>
  • SortedSet<T>
  • ImmutableHashSet<T>

Map-like

  • Dictionary<TKey, TValue>
  • SortedDictionary<TKey, TValue>
  • SortedList<TKey, TValue>
  • ConcurrentDictionary<TKey, TValue>
  • NullableKeyDictionary<TKey, TValue>

Time Types

C# TypeWire Type
DateOnlyDate
DateTimeTimestamp
DateTimeOffsetTimestamp
TimeSpanDuration

User Types

  • [ForyStruct] classes/structs via source-generated serializers
  • Ordinary class hierarchies when every first-party class is directly annotated; the concrete serializer uses one flattened schema
  • Private or protected ordinary base members selected with [ForyField]
  • Unmodified third-party base hierarchies described by one explicit external declaration
  • [ForyEnum] enums and [ForyUnion] ADT records
  • External class, struct, and enum targets through serializer declarations
  • Custom serializer types registered through Register<T, TSerializer>(...)
  • Union / Union2<...> typed union support

[ForyEnum] numeric values are unsigned 32-bit wire tags and must be in the range 0..uint.MaxValue.

Open generic generated targets are unsupported. A non-generic ordinary class may derive from a closed third-party generic base when an external declaration describes that exact closed base. On .NET 8, private wire members whose declaring type or signature is generic are unsupported; visible members and explicit storage-only field declarations remain supported.

Dynamic Types

Dynamic object payloads via Serialize<object?> / Deserialize<object?> support:

  • Primitive/object values
  • Dynamic lists/sets/maps
  • Nested dynamic structures

Notes

  • User-defined types should be registered explicitly.
  • For cross-language usage, follow the xlang guide.