Ejemplo n.º 1
0
        /// <summary>
        /// Tests whether or not all columns in this collection have the same type.
        /// </summary>
        /// <param name="col">The column collection containing the columns to test.</param>
        /// <param name="selectedColumnIndices">The column indices of the columns to test.</param>
        /// <param name="firstdifferentcolumnindex">Out: returns the first column that has a different type from the first column</param>.
        /// <returns>True if all selected columns are of the same type. True is also returned if the number of selected columns is zero.</returns>
        public static bool AreAllColumnsOfTheSameType(DataColumnCollection col, IContiguousIntegerRange selectedColumnIndices, out int firstdifferentcolumnindex)
        {
            firstdifferentcolumnindex = 0;

            if (0 == col.ColumnCount || 0 == selectedColumnIndices.Count)
            {
                return(true);
            }

            System.Type firstType = col[selectedColumnIndices[0]].GetType();

            int len = selectedColumnIndices.Count;

            for (int i = 0; i < len; i++)
            {
                if (col[selectedColumnIndices[i]].GetType() != firstType)
                {
                    firstdifferentcolumnindex = selectedColumnIndices[i];
                    return(false);
                }
            }

            return(true);
        }
 /// <summary>
 /// Constructs an integer range from another integer range.
 /// </summary>
 /// <param name="from">The integer range to copy from.</param>
 public ContiguousNonNegativeIntegerRange(IContiguousIntegerRange from)
 {
     _start = from.Start;
     _count = from.Count;
     EnsureValidity();
 }
		/// <summary>
		/// Constructs an integer range from another integer range.
		/// </summary>
		/// <param name="from">The integer range to copy from.</param>
		public ContiguousNonNegativeIntegerRange(IContiguousIntegerRange from)
		{
			_start = from.Start;
			_count = from.Count;
			EnsureValidity();
		}
Ejemplo n.º 4
0
 /// <summary>
 /// Constructs an integer range from another integer range.
 /// </summary>
 /// <param name="from">The integer range to copy from.</param>
 public ContiguousIntegerRange(IContiguousIntegerRange from)
 {
     AssertValidStartAndCount(from.Start, from.Count);
     _start = from.Start;
     _count = (uint)from.Count;
 }