private static void WriteArray_(
            ICurlyBracketStringBuilder cbsb,
            ITypeSymbol sourceSymbol,
            ISchemaMember member)
        {
            var arrayType = member.MemberType as ISequenceMemberType;

            if (arrayType.LengthSourceType != SequenceLengthSourceType.CONST)
            {
                var isImmediate =
                    arrayType.LengthSourceType ==
                    SequenceLengthSourceType.IMMEDIATE_VALUE;

                if (isImmediate)
                {
                    var writeType = SchemaGeneratorUtil.GetIntLabel(
                        arrayType.ImmediateLengthType);

                    var castType = SchemaGeneratorUtil.GetTypeName(
                        SchemaPrimitiveTypesUtil.ConvertIntToNumber(
                            arrayType.ImmediateLengthType));

                    var arrayLengthName = arrayType.SequenceType == SequenceType.ARRAY
                                    ? "Length"
                                    : "Count";
                    var arrayLengthAccessor = $"this.{member.Name}.{arrayLengthName}";

                    cbsb.WriteLine(
                        $"ew.Write{writeType}(({castType}) {arrayLengthAccessor});");
                }
            }

            SchemaWriterGenerator.WriteIntoArray_(cbsb, sourceSymbol, member);
        }
        private static void WriteMember_(
            ICurlyBracketStringBuilder cbsb,
            ITypeSymbol sourceSymbol,
            ISchemaMember member)
        {
            if (member.IsPosition)
            {
                return;
            }

            if (member.Offset != null)
            {
                cbsb.WriteLine("throw new NotImplementedException();");
                return;
            }

            SchemaWriterGenerator.Align_(cbsb, member);

            var ifBoolean = member.IfBoolean;

            if (ifBoolean != null)
            {
                if (ifBoolean.SourceType == IfBooleanSourceType.IMMEDIATE_VALUE)
                {
                    var booleanNumberType =
                        SchemaPrimitiveTypesUtil.ConvertIntToNumber(
                            ifBoolean.ImmediateBooleanType);
                    var booleanPrimitiveType =
                        SchemaPrimitiveTypesUtil.ConvertNumberToPrimitive(
                            booleanNumberType);
                    var booleanNumberLabel =
                        SchemaGeneratorUtil.GetTypeName(booleanNumberType);
                    var booleanPrimitiveLabel =
                        SchemaGeneratorUtil.GetPrimitiveLabel(booleanPrimitiveType);
                    cbsb.WriteLine(
                        $"ew.Write{booleanPrimitiveLabel}(({booleanNumberLabel}) (this.{member.Name} != null ? 1 : 0));")
                    .EnterBlock($"if (this.{member.Name} != null)");
                }
                else
                {
                    cbsb.EnterBlock($"if (this.{ifBoolean.BooleanMember.Name})");
                }
            }

            var memberType = member.MemberType;

            if (memberType is IGenericMemberType genericMemberType)
            {
                memberType = genericMemberType.ConstraintType;
            }

            switch (memberType)
            {
            case IPrimitiveMemberType: {
                SchemaWriterGenerator.WritePrimitive_(cbsb, member);
                break;
            }

            case IStringType: {
                SchemaWriterGenerator.WriteString_(cbsb, member);
                break;
            }

            case IStructureMemberType structureMemberType: {
                SchemaWriterGenerator.WriteStructure_(cbsb, member);
                break;
            }

            case ISequenceMemberType: {
                SchemaWriterGenerator.WriteArray_(cbsb, sourceSymbol, member);
                break;
            }

            default:
                // Anything that makes it down here probably isn't meant to be read.
                throw new NotImplementedException();
            }

            if (ifBoolean != null)
            {
                cbsb.ExitBlock();
            }
        }
        private static void ReadMember_(
            ICurlyBracketStringBuilder cbsb,
            ITypeSymbol sourceSymbol,
            ISchemaMember member)
        {
            if (member.IsPosition)
            {
                if (member.MemberType.IsReadonly)
                {
                    cbsb.WriteLine($"er.AssertPosition(this.{member.Name});");
                }
                else
                {
                    cbsb.WriteLine($"this.{member.Name} = er.Position;");
                }
                return;
            }

            SchemaReaderGenerator.Align_(cbsb, member);

            // TODO: How to handle both offset & if boolean together?

            var offset = member.Offset;

            if (offset != null)
            {
                cbsb.EnterBlock()
                .WriteLine("var tempLocation = er.Position;")
                .WriteLine(
                    $"er.Position = this.{offset.StartIndexName.Name} + this.{offset.OffsetName.Name};");
            }

            var ifBoolean          = member.IfBoolean;
            var immediateIfBoolean =
                ifBoolean?.SourceType == IfBooleanSourceType.IMMEDIATE_VALUE;

            if (immediateIfBoolean)
            {
                cbsb.EnterBlock();
            }
            if (ifBoolean != null)
            {
                if (ifBoolean.SourceType == IfBooleanSourceType.IMMEDIATE_VALUE)
                {
                    var booleanNumberType =
                        SchemaPrimitiveTypesUtil.ConvertIntToNumber(
                            ifBoolean.ImmediateBooleanType);
                    var booleanPrimitiveType =
                        SchemaPrimitiveTypesUtil.ConvertNumberToPrimitive(
                            booleanNumberType);
                    var booleanPrimitiveLabel =
                        SchemaGeneratorUtil.GetPrimitiveLabel(booleanPrimitiveType);
                    cbsb.WriteLine($"var b = er.Read{booleanPrimitiveLabel}() != 0;")
                    .EnterBlock("if (b)");
                }
                else
                {
                    cbsb.EnterBlock($"if (this.{ifBoolean.BooleanMember.Name})");
                }

                if (member.MemberType is not IPrimitiveMemberType)
                {
                    cbsb.WriteLine(
                        $"this.{member.Name} = new {SymbolTypeUtil.GetQualifiedNameFromCurrentSymbol(sourceSymbol, member.MemberType.TypeSymbol)}();");
                }
            }

            var memberType = member.MemberType;

            if (memberType is IGenericMemberType genericMemberType)
            {
                memberType = genericMemberType.ConstraintType;
            }

            switch (memberType)
            {
            case IPrimitiveMemberType: {
                SchemaReaderGenerator.ReadPrimitive_(cbsb, sourceSymbol, member);
                break;
            }

            case IStringType: {
                SchemaReaderGenerator.ReadString_(cbsb, member);
                break;
            }

            case IStructureMemberType structureMemberType: {
                SchemaReaderGenerator.ReadStructure_(cbsb,
                                                     structureMemberType,
                                                     member);
                break;
            }

            case ISequenceMemberType: {
                SchemaReaderGenerator.ReadArray_(cbsb, sourceSymbol, member);
                break;
            }

            default: {
                // Anything that makes it down here probably isn't meant to be read.
                throw new NotImplementedException();
            }
            }

            if (ifBoolean != null)
            {
                cbsb.ExitBlock()
                .EnterBlock("else")
                .WriteLine($"this.{member.Name} = null;")
                .ExitBlock();
                if (immediateIfBoolean)
                {
                    cbsb.ExitBlock();
                }
            }

            if (offset != null)
            {
                cbsb.WriteLine("er.Position = tempLocation;")
                .ExitBlock();
            }
        }