Ejemplo n.º 1
0
        public DelegateFormatter(CerasSerializer ceras)
        {
            _methodInfoFormatter = ceras.GetFormatter <MethodInfo>();
            _targetFormatter     = ceras.GetFormatter <object>();

            _allowStatic   = (ceras.Config.Advanced.DelegateSerialization & DelegateSerializationFlags.AllowStatic) != 0;
            _allowInstance = (ceras.Config.Advanced.DelegateSerialization & DelegateSerializationFlags.AllowInstance) != 0;
        }
Ejemplo n.º 2
0
        static void InterfaceFormatterTest()
        {
            CerasSerializer ceras = new CerasSerializer();

            var intListFormatter = ceras.GetFormatter <IList <int> >();

            List <int> list = new List <int> {
                1, 2, 3, 4
            };


            byte[] buffer = new byte[200];
            int    offset = 0;

            intListFormatter.Serialize(ref buffer, ref offset, list);


            // Deserializing into a IList variable should be no problem!

            offset = 0;
            IList <int> clonedList = null;

            intListFormatter.Deserialize(buffer, ref offset, ref clonedList);

            Debug.Assert(clonedList != null);
            Debug.Assert(clonedList.SequenceEqual(list));
        }
Ejemplo n.º 3
0
 public MemberInfoFormatter(CerasSerializer serializer)
 {
     _stringFormatter = serializer.GetFormatter <string>();
     _typeFormatter   = (IFormatter <Type>)serializer.GetSpecificFormatter(typeof(Type));
 }
Ejemplo n.º 4
0
 public DelegateFormatter(CerasSerializer ceras)
 {
     _ceras = ceras;
     _methodInfoFormatter = ceras.GetFormatter <MethodInfo>();
 }
Ejemplo n.º 5
0
 public KeyValuePairFormatter(CerasSerializer serializer)
 {
     _keyFormatter   = (IFormatter <TKey>)serializer.GetFormatter <TKey>();
     _valueFormatter = (IFormatter <TValue>)serializer.GetFormatter <TValue>();
 }