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

Method TryGetTypeId

csharp/src/Fory/CollectionSerializers.cs:314–337  ·  view source on GitHub ↗
(object value, out TypeId typeId)

Source from the content-addressed store, hash-verified

312internal static class DynamicContainerCodec
313{
314 public static bool TryGetTypeId(object value, out TypeId typeId)
315 {
316 if (value is IDictionary)
317 {
318 typeId = TypeId.Map;
319 return true;
320 }
321
322 Type valueType = value.GetType();
323 if (IsListLike(value, valueType))
324 {
325 typeId = TypeId.List;
326 return true;
327 }
328
329 if (IsSet(valueType))
330 {
331 typeId = TypeId.Set;
332 return true;
333 }
334
335 typeId = default;
336 return false;
337 }
338
339 public static bool TryWritePayload(object value, WriteContext context, bool hasGenerics)
340 {

Callers 1

WriteAnyTypeInfoMethod · 0.80

Calls 1

GetTypeMethod · 0.65

Tested by

no test coverage detected