Esempio n. 1
0
        internal static SerializableMemberList GetSerializableMembers(Type type)
        {
            ExceptionHelper.ThrowIfArgumentNull(type, "type");
            SerializableMemberList serializableMembers = _serializableMembersCache[type];

            if (serializableMembers == null)
            {
                serializableMembers             = new SerializableMemberList(FormatterServices.GetSerializableMembers(type));
                _serializableMembersCache[type] = serializableMembers;
            }
            return(serializableMembers);
        }
Esempio n. 2
0
        public SerializableObject(object obj)
        {
            ExceptionHelper.ThrowIfArgumentNull(obj, "obj");
            _obj = obj;
            SerializableMemberList serializableMembers = SerializationHelper.GetSerializableMembers(obj.GetType());

            _count = serializableMembers.Count;
            _dict  = new Dictionary <string, SerializableMember>(_count);
            foreach (SerializableMember serializableMember in serializableMembers)
            {
                if (!_dict.ContainsKey(serializableMember.Name))
                {
                    _dict.Add(serializableMember.Name, new SerializableMember(serializableMember, obj));
                }
            }
        }