コード例 #1
0
        internal static bool IsReadOnlyAppendableCollectionMember(MemberInfo memberInfo)
        {
            Contract.Requires(memberInfo != null);
            if (memberInfo.CanSetValue())
            {
                return(false);
            }
            Type memberValueType = memberInfo.GetMemberValueType();

            if (memberValueType.IsArray)
            {
                return(false);
            }
            CollectionTraits collectionTraits = memberValueType.GetCollectionTraits();

            return((collectionTraits.CollectionType != CollectionKind.NotCollection) && (collectionTraits.AddMethod != null));
        }