public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
        {
            MemberInfo[] serializableMembers;
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (!(type is RuntimeType))
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", new object[] { type.ToString() }));
            }
            MemberHolder key = new MemberHolder(type, context);

            if (m_MemberInfoTable.ContainsKey(key))
            {
                return(m_MemberInfoTable[key]);
            }
            lock (formatterServicesSyncObject)
            {
                if (m_MemberInfoTable.ContainsKey(key))
                {
                    return(m_MemberInfoTable[key]);
                }
                serializableMembers    = InternalGetSerializableMembers((RuntimeType)type);
                m_MemberInfoTable[key] = serializableMembers;
            }
            return(serializableMembers);
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (!(obj is MemberHolder))
            {
                return(false);
            }
            MemberHolder memberHolder = (MemberHolder)obj;

            return(memberHolder.memberType == this.memberType && memberHolder.context.State == this.context.State);
        }
        public override bool Equals(object obj)
        {
            if (!(obj is MemberHolder))
            {
                return(false);
            }
            MemberHolder holder = (MemberHolder)obj;

            return(object.ReferenceEquals(holder.memberType, this.memberType) && (holder.context.State == this.context.State));
        }
Пример #4
0
        public override bool Equals(Object obj)
        {
            if (!(obj is MemberHolder))
            {
                return(false);
            }

            MemberHolder temp = (MemberHolder)obj;

            if (Object.ReferenceEquals(temp.memberType, memberType) && temp.context.State == context.State)
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
        public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (!(type is RuntimeType))
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", new object[]
                {
                    type.ToString()
                }));
            }
            MemberHolder key = new MemberHolder(type, context);

            return(FormatterServices.m_MemberInfoTable.GetOrAdd(key, (MemberHolder _) => FormatterServices.InternalGetSerializableMembers((RuntimeType)type)));
        }
Пример #6
0
        public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
        {
            MemberInfo[] members;

            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (!(type is RuntimeType))
            {
                throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_InvalidType"), type.ToString()));
            }

            MemberHolder mh = new MemberHolder(type, context);

            //If we've already gathered the members for this type, just return them.
            if ((members = (MemberInfo[])m_MemberInfoTable[mh]) != null)
            {
                return(members);
            }

            lock (typeof(FormatterServices)) {
                //If we've already gathered the members for this type, just return them.
                if ((members = (MemberInfo[])m_MemberInfoTable[mh]) != null)
                {
                    return(members);
                }

                //If we're not cloning, get all of the non-transient members.  If we are cloning, then we know that
                //we're going to live inside of the same context, so copy the transient members as well.
                if (context.State == StreamingContextStates.Clone)
                {
                    members = InternalGetSerializableMembers((RuntimeType)type, false);
                }
                else
                {
                    members = InternalGetSerializableMembers((RuntimeType)type, true);
                }

                m_MemberInfoTable[mh] = members;
            }

            return(members);
        }
Пример #7
0
        [System.Security.SecurityCritical]  // auto-generated_required
        public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
        {
            if ((object)type == null)
            {
                throw new ArgumentNullException("type");
            }
            Contract.EndContractBlock();

            if (!(type is RuntimeType))
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", type.ToString()));
            }

            MemberHolder mh = new MemberHolder(type, context);

            //If we've already gathered the members for this type, just return them.
            MemberInfo[] members = m_MemberInfoTable.GetOrAdd(mh,
                                                              _ => InternalGetSerializableMembers((RuntimeType)type));

            return(members);
        }
Пример #8
0
        [System.Security.SecurityCritical]  // auto-generated_required
        public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
        {
            MemberInfo[] members;

            if ((object)type == null)
            {
                throw new ArgumentNullException("type");
            }
            Contract.EndContractBlock();

            if (!(type is RuntimeType))
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", type.ToString()));
            }

            MemberHolder mh = new MemberHolder(type, context);

            //If we've already gathered the members for this type, just return them.
            if (m_MemberInfoTable.ContainsKey(mh))
            {
                return(m_MemberInfoTable[mh]);
            }

            lock (formatterServicesSyncObject) {
                //If we've already gathered the members for this type, just return them.
                if (m_MemberInfoTable.ContainsKey(mh))
                {
                    return(m_MemberInfoTable[mh]);
                }

                members = InternalGetSerializableMembers((RuntimeType)type);

                m_MemberInfoTable[mh] = members;
            }

            return(members);
        }
 public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context)
 {
     MemberInfo[] serializableMembers;
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (!(type is RuntimeType))
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", new object[] { type.ToString() }));
     }
     MemberHolder key = new MemberHolder(type, context);
     if (m_MemberInfoTable.ContainsKey(key))
     {
         return m_MemberInfoTable[key];
     }
     lock (formatterServicesSyncObject)
     {
         if (m_MemberInfoTable.ContainsKey(key))
         {
             return m_MemberInfoTable[key];
         }
         serializableMembers = InternalGetSerializableMembers((RuntimeType) type);
         m_MemberInfoTable[key] = serializableMembers;
     }
     return serializableMembers;
 }
        [System.Security.SecurityCritical]  // auto-generated_required
        public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context) {
            MemberInfo[] members;
 
            if ((object)type==null) {
                throw new ArgumentNullException("type"); 
            } 
            Contract.EndContractBlock();
 
            if (!(type is RuntimeType)) {
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", type.ToString()));
            }
 
            MemberHolder mh = new MemberHolder(type, context);
 
            //If we've already gathered the members for this type, just return them. 
            if (m_MemberInfoTable.ContainsKey(mh)) {
                return m_MemberInfoTable[mh]; 
            }

            lock (formatterServicesSyncObject) {
                //If we've already gathered the members for this type, just return them. 
                if (m_MemberInfoTable.ContainsKey(mh)) {
                    return m_MemberInfoTable[mh]; 
                } 

                members = InternalGetSerializableMembers((RuntimeType)type); 

                m_MemberInfoTable[mh] = members;
            }
 
            return members;
        } 
Пример #11
0
        public static MemberInfo[] GetSerializableMembers(Type type, StreamingContext context) {
            MemberInfo[] members;
    
            if (type==null) {
                throw new ArgumentNullException("type");
            }

            if (!(type is RuntimeType)) {
                throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_InvalidType"), type.ToString()));
            }
    
            MemberHolder mh = new MemberHolder(type, context);
    
            //If we've already gathered the members for this type, just return them.
            if ((members=(MemberInfo[])m_MemberInfoTable[mh])!=null) {
                return members;
            }
            
            lock (typeof(FormatterServices)) {
                //If we've already gathered the members for this type, just return them.
                if ((members=(MemberInfo[])m_MemberInfoTable[mh])!=null) {
                    return members;
                }

                //If we're not cloning, get all of the non-transient members.  If we are cloning, then we know that
                //we're going to live inside of the same context, so copy the transient members as well.
                if (context.State==StreamingContextStates.Clone) {
                    members = InternalGetSerializableMembers((RuntimeType)type, false);
                } else {
                    members = InternalGetSerializableMembers((RuntimeType)type, true);
                }
            
                m_MemberInfoTable[mh] = members;
            }
    
            return members;
        }