Exemple #1
0
        public override byte[] Serialize(object input, TLPropertyAttribute attribute)
        {
            TLObject obj = (TLObject)input;

            List <byte> list = obj.GetTLProperties()
                               .Select(x => TLRootSerializer.Serialize(x.GetValue(obj), attribute))
                               .SelectMany(x => x)
                               .ToList();

            UInt32 classId = obj.GetClassId();

            if (classId != 0)
            {
                list.InsertRange(0, TLRootSerializer.Serialize(classId));
            }

            return(list.ToArray());
        }