Esempio n. 1
0
        internal static void SerializeViaAttribute <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                                                   string attributeName, ref ListLimitTraits traits)
            where TDoc : class
            where TCursor : class
        {
            s.StreamAttribute(attributeName, ref traits.MaxCount);

            if (s.IsReading)
            {
                traits.InitializeBitLengths();
            }
        }
Esempio n. 2
0
        internal static void SerializeViaElementOpt <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s,
                                                                    string elementName, ref ListLimitTraits traits)
            where TDoc : class
            where TCursor : class
        {
            bool streamed = s.StreamElementOpt(elementName, ref traits.MaxCount, Predicates.IsNotZero);

            if (streamed && s.IsReading)
            {
                traits.InitializeBitLengths();
            }
        }
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            s.StreamableElements("Member", Members);

            if (s.IsReading)
            {
                TypeTraits.MaxCount = Members.Count;
                TypeTraits.InitializeBitLengths();

                int index = 0;
                foreach (var member in Members)
                {
                    member.TypeIndex = index++;
                    NameToMember.Add(member.Name, member);
                }
            }
        }