Beispiel #1
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);
        }
        // Get all of the Serializable Members for a particular class.  If we're not cloning, this is all
        // non-transient, non-static fields.  If we are cloning, include the transient fields as well since
        // we know that we're going to live inside of the same context.
        // [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 Type))
            {
                throw new SerializationException(Ssz.Runtime.Serialization.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((Type)type));

            return(members);
        }