Exemplo n.º 1
0
        public static void _SerializerSwitch(Stream stream, object value, ObjectList objList)
        {
            if (objList != null)
            {
                int index = objList.IndexOf(value);
                if (index != -1)
                {
                    value = new ObjectRef(index);
                }
            }

            if (value == null)
            {
                Primitives.WritePrimitive(stream, (ushort)0, objList);
            }
            else
            {
                TypeData typeData;
                if (!s_typeMap.TryGetValue(value.GetType(), out typeData))
                    throw new InvalidOperationException(String.Format("Unknown type = {0}", value.GetType().FullName));

                Primitives.WritePrimitive(stream, typeData.TypeID, objList);
                typeData.serializer(stream, value, objList);
            }
        }
Exemplo n.º 2
0
 public object GetAt(ObjectRef oref)
 {
     if (oref.obj_ref >= size)
         throw new ArgumentOutOfRangeException("index");
     return elementData[oref.obj_ref];
 }