예제 #1
0
        public void CopyTo()
        {
            DataTableCollection tbcol = _dataset[0].Tables;

            tbcol.Add("Table1");
            tbcol.Add("Table2");
            tbcol.Add("Table3");
            tbcol.Add("Table4");

            DataTable[] array = new DataTable[4];
            /* copying to the beginning of the array */
            tbcol.CopyTo(array, 0);
            Assert.Equal(4, array.Length);
            Assert.Equal("Table1", array[0].TableName);
            Assert.Equal("Table2", array[1].TableName);
            Assert.Equal("Table3", array[2].TableName);
            Assert.Equal("Table4", array[3].TableName);

            /* copying with in a array */
            DataTable[] array1 = new DataTable[6];
            tbcol.CopyTo(array1, 2);
            Assert.Equal(null, array1[0]);
            Assert.Equal(null, array1[1]);
            Assert.Equal("Table1", array1[2].TableName);
            Assert.Equal("Table2", array1[3].TableName);
            Assert.Equal("Table3", array1[4].TableName);
            Assert.Equal("Table4", array1[5].TableName);
        }
        public void CopyTo()
        {
            DataTableCollection tbcol = _dataset[0].Tables;

            tbcol.Add("Table1");
            tbcol.Add("Table2");
            tbcol.Add("Table3");
            tbcol.Add("Table4");

            DataTable [] array = new DataTable[4];
            /* copying to the beginning of the array */
            tbcol.CopyTo(array, 0);
            Assert.AreEqual(4, array.Length, "test#01");
            Assert.AreEqual("Table1", array[0].TableName, "test#02");
            Assert.AreEqual("Table2", array[1].TableName, "test#03");
            Assert.AreEqual("Table3", array[2].TableName, "test#04");
            Assert.AreEqual("Table4", array[3].TableName, "test#05");

            /* copying with in a array */
            DataTable [] array1 = new DataTable[6];
            tbcol.CopyTo(array1, 2);
            Assert.AreEqual(null, array1[0], "test#06");
            Assert.AreEqual(null, array1[1], "test#07");
            Assert.AreEqual("Table1", array1[2].TableName, "test#08");
            Assert.AreEqual("Table2", array1[3].TableName, "test#09");
            Assert.AreEqual("Table3", array1[4].TableName, "test#10");
            Assert.AreEqual("Table4", array1[5].TableName, "test#11");
        }
예제 #3
0
        public IEnumerator <FeatureDataTable> GetEnumerator()
        {
            var dataTables = new DataTable[_dataTables.Count];

            _dataTables.CopyTo(dataTables, 0);

            foreach (var dataTable in dataTables)
            {
                if (dataTable is FeatureDataTable)
                {
                    yield return((FeatureDataTable)dataTable);
                }
            }
        }
예제 #4
0
 public void CopyTo(FeatureDataTable[] array, Int32 arrayIndex)
 {
     _tables.CopyTo(array, arrayIndex);
 }