コード例 #1
0
        ///<summary>
        /// Creates an exact copy of this VList{T} object.
        ///</summary>
        ///<returns>A new, identical copy of the VList{T}.</returns>
        public virtual VList <T> Copy()
        {
            VList <T> copy = new VList <T>();

            foreach (T item in this)
            {
                T itemCopy = (T)MakeCopyOf(item);
                copy.Add(itemCopy);
            }
            return(copy);
        }
コード例 #2
0
        ///<summary>
        /// Finds a collection of <see cref="IEntity" /> objects in the current list matching the search criteria.
        ///</summary>
        /// <param name="findAllByType"><see cref="FindAllByType" /> Type to easily search by</param>
        /// <param name="propertyName">Property of the object to search.</param>
        /// <param name="value">Value to find.</param>
        /// <param name="ignoreCase">A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).  String properties only.</param>
        public virtual VList <T> FindAllBy(FindAllByType findAllByType, string propertyName, object value, bool ignoreCase)
        {
            PropertyDescriptorCollection props    = base.PropertyCollection;
            PropertyDescriptor           searchBy = props.Find(propertyName, true);

            VList <T> result = new VList <T>();

            int index = 0;

            while (index > -1)
            {
                index = this.FindAllBy(findAllByType, searchBy, value, index, ignoreCase);

                if (index > -1)
                {
                    result.Add(this[index]);

                    //Increment the index to start at the next item
                    index++;
                }
            }

            return(result);
        }