internal ushort GetTypeSeq(TypeMap typeMap, BinarySerializerOptions options)
        {
            Debug.Assert(RuntimeType != null);
            Debug.Assert(typeMap != null);

            bool isAdd = typeMap.TryAdd(RuntimeType, out BinaryTypeInfo ti);

            if (isAdd || ti.Type == TypeEnum.None)
            {
                ti.IsGeneric            = RuntimeType.IsGenericType;
                ti.GenericArgumentCount = RuntimeType.GetGenericArgumentCount();
                if (ti.GenericArgumentCount > 0)
                {
                    ti.GenericArguments = RuntimeType.GetGenericArguments()
                                          .Select(t =>
                    {
                        var converter = options.GetConverter(t);
                        Debug.Assert(converter != null);
                        return(converter.GetTypeSeq(typeMap, options));
                    }).ToArray();
                }
                SetTypeMetadata(ti, typeMap, options);
            }

            return(ti.Seq);
        }