CopyTo() 공개 메소드

public CopyTo ( Array array, int arrayIndex ) : void
array Array
arrayIndex int
리턴 void
		protected override void Reload () 
		{
			System.Collections.Hashtable ht = new System.Collections.Hashtable ();
			Photo [] photos = query.Store.Query ((Tag [])null, null, null, null);
			
			foreach (Photo p in photos) {
				if (ht.Contains (p.DirectoryPath)) {
					DirectoryAdaptor.Group group = (DirectoryAdaptor.Group) ht [p.DirectoryPath];
					group.Count += 1;
				} else 
					ht [p.DirectoryPath] = new DirectoryAdaptor.Group ();
			}
			
			Console.WriteLine ("Count = {0}", ht.Count);
			dirs = new System.Collections.DictionaryEntry [ht.Count];
			ht.CopyTo (dirs, 0);
			
			Array.Sort (dirs, new DirectoryAdaptor.Group ());
			Array.Sort (query.Photos, new Photo.CompareDirectory ());
			
			if (!order_ascending) {
				Array.Reverse (dirs);
				Array.Reverse (query.Photos);
			}
			
			if (Changed != null)
				Changed (this);
		}
예제 #2
0
 public override void CopyTo(Array array, int arrayIndex)
 {
     lock (_table.SyncRoot)
     {
         _table.CopyTo(array, arrayIndex);
     }
 }
예제 #3
0
 // Implement the ICollection interface.
 public override void CopyTo(Array array, int index)
 {
     lock (SyncRoot)
     {
         table.CopyTo(array, index);
     }
 }
 static int CopyTo(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         System.Collections.Hashtable obj = (System.Collections.Hashtable)ToLua.CheckObject(L, 1, typeof(System.Collections.Hashtable));
         System.Array arg0 = (System.Array)ToLua.CheckObject(L, 2, typeof(System.Array));
         int          arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.CopyTo(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #5
0
 static public int CopyTo(IntPtr l)
 {
     try {
         System.Collections.Hashtable self = (System.Collections.Hashtable)checkSelf(l);
         System.Array a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.CopyTo(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #6
0
        public static Hashtable applyKeepWords(Hashtable centroidValues, int keepWords)
        {
            DictionaryEntry[] centValuesArr = new DictionaryEntry[centroidValues.Count];

            centroidValues.CopyTo(centValuesArr, 0);

            Array.Sort(centValuesArr, new DictionaryEntryValueComparer());
            Array.Reverse(centValuesArr);

            Hashtable finalCentroidValues = new Hashtable();

            for (int i = 0; i < keepWords && i < centValuesArr.Length; i++)
            {
                DictionaryEntry entry = centValuesArr[i];
                finalCentroidValues.Add(entry.Key, entry.Value);
            }

            return (finalCentroidValues);
        }
예제 #7
0
        protected override void Reload()
        {
            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            Photo [] photos = query.Store.Query((Tag [])null, null, null, null);

            foreach (Photo p in photos)
            {
                if (ht.Contains(p.DirectoryPath))
                {
                    DirectoryAdaptor.Group group = (DirectoryAdaptor.Group)ht [p.DirectoryPath];
                    group.Count += 1;
                }
                else
                {
                    ht [p.DirectoryPath] = new DirectoryAdaptor.Group();
                }
            }

            Console.WriteLine("Count = {0}", ht.Count);
            dirs = new System.Collections.DictionaryEntry [ht.Count];
            ht.CopyTo(dirs, 0);

            Array.Sort(dirs, new DirectoryAdaptor.Group());
            Array.Sort(query.Photos, new Photo.CompareDirectory());

            if (!order_ascending)
            {
                Array.Reverse(dirs);
                Array.Reverse(query.Photos);
            }

            if (Changed != null)
            {
                Changed(this);
            }
        }
예제 #8
0
	public void TestCopyTo() {
		{
			bool errorThrown = false;
			try {
				Hashtable h = new Hashtable();
				h.CopyTo(null, 0);
			} catch (ArgumentNullException e) {
				errorThrown = true;
				Assert.AreEqual ("array", e.ParamName, "ParamName is not \"array\""); 
			}
			Assert.IsTrue (errorThrown, "null hashtable error not thrown");
		}
		{
			bool errorThrown = false;
			try {
				Hashtable h = new Hashtable();
				Object[] o = new Object[1];
				h.CopyTo(o, -1);
			} catch (ArgumentOutOfRangeException e) {
				errorThrown = true;
				Assert.AreEqual ("arrayIndex", e.ParamName, "ParamName is not \"arrayIndex\"");
			}
			Assert.IsTrue (errorThrown, "out of range error not thrown");
		}
		{
			bool errorThrown = false;
			try {
				Hashtable h = new Hashtable();
				Object[,] o = new Object[1,1];
				h.CopyTo(o, 1);
			} catch (ArgumentException) {
				errorThrown = true;
			}
			Assert.IsTrue (errorThrown, "multi-dim array error not thrown");
		}
		{
			bool errorThrown = false;
			try {
				Hashtable h = new Hashtable();
				h['a'] = 1; // no error if table is empty
				Object[] o = new Object[5];
				h.CopyTo(o, 5);
			} catch (ArgumentException) {
				errorThrown = true;
			}
			Assert.IsTrue (errorThrown, "no room in array error not thrown");
		}
		{
			bool errorThrown = false;
			try {
				Hashtable h = new Hashtable();
				h['a'] = 1;
				h['b'] = 2;
				h['c'] = 2;
				Object[] o = new Object[2];
				h.CopyTo(o, 0);
			} catch (ArgumentException) {
				errorThrown = true;
			}
			Assert.IsTrue (errorThrown, "table too big error not thrown");
		}
		{
			bool errorThrown = false;
			try {
				Hashtable h = new Hashtable();
				h["blue"] = 1;
				h["green"] = 2;
				h["red"] = 3;
				Char[] o = new Char[3];
				h.CopyTo(o, 0);
			} catch (InvalidCastException) {
				errorThrown = true;
			}
			Assert.IsTrue (errorThrown, "invalid cast error not thrown");
		}

		{
			Hashtable h = new Hashtable();
			h['a'] = 1;
			h['b'] = 2;
			DictionaryEntry[] o = new DictionaryEntry[2];
			h.CopyTo(o,0);
			Assert.AreEqual ('a', o[0].Key, "first copy fine.");
			Assert.AreEqual (1, o[0].Value, "first copy fine.");
			Assert.AreEqual ('b', o[1].Key, "second copy fine.");
			Assert.AreEqual (2, o[1].Value, "second copy fine.");
		}
	}
예제 #9
0
파일: KeyedList.cs 프로젝트: jakedw7/iAM
 public void CopyTo(Array array, int idx)
 {
     objectTable.CopyTo(array, idx);
 }
예제 #10
0
 void ICollection.CopyTo(Array array, int index)
 {
     _innerhash.CopyTo(array, index);
 }
예제 #11
0
        public void TestCtorIntSingle()
        {
            // variables used for tests
            Hashtable hash = null;

            // [] should get ArgumentException if trying to have large num of entries
            Assert.Throws<ArgumentException>(() =>
            {
                hash = new Hashtable(int.MaxValue, .1f);
            }
            );

            // []should not get any exceptions for valid values - we also check that the HT works here
            hash = new Hashtable(100, .1f);

            int iNumberOfElements = 100;
            for (int i = 0; i < iNumberOfElements; i++)
            {
                hash.Add("Key_" + i, "Value_" + i);
            }

            //Count
            Assert.Equal(hash.Count, iNumberOfElements);

            DictionaryEntry[] strValueArr = new DictionaryEntry[hash.Count];
            hash.CopyTo(strValueArr, 0);

            Hashtable hsh3 = new Hashtable();
            for (int i = 0; i < iNumberOfElements; i++)
            {
                Assert.True(hash.Contains("Key_" + i), "Error, Expected value not returned, " + hash.Contains("Key_" + i));
                Assert.True(hash.ContainsKey("Key_" + i), "Error, Expected value not returned, " + hash.ContainsKey("Key_" + i));
                Assert.True(hash.ContainsValue("Value_" + i), "Error, Expected value not returned, " + hash.ContainsValue("Value_" + i));

                //we still need a way to make sure that there are all these unique values here -see below code for that
                Assert.True(hash.ContainsValue(((DictionaryEntry)strValueArr[i]).Value), "Error, Expected value not returned, " + ((DictionaryEntry)strValueArr[i]).Value);

                hsh3.Add(((DictionaryEntry)strValueArr[i]).Value, null);
            }
        }
예제 #12
0
        public void TestSynchronizedBasic()
        {
            Hashtable hsh1;

            string strValue;

            Task[] workers;
            Action ts1;
            int iNumberOfWorkers = 3;
            DictionaryEntry[] strValueArr;
            string[] strKeyArr;
            Hashtable hsh3;
            Hashtable hsh4;
            IDictionaryEnumerator idic;

            object oValue;

            //[]Vanila - Syncronized returns a wrapped HT. We must make sure that all the methods
            //are accounted for here for the wrapper
            hsh1 = new Hashtable();
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                hsh1.Add("Key_" + i, "Value_" + i);
            }

            _hsh2 = Hashtable.Synchronized(hsh1);
            //Count
            Assert.Equal(_hsh2.Count, hsh1.Count);

            //get/set item
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                Assert.True(((string)_hsh2["Key_" + i]).Equals("Value_" + i));
            }

            Assert.Throws<ArgumentNullException>(() =>
                {
                    oValue = _hsh2[null];
                });

            _hsh2.Clear();
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                _hsh2["Key_" + i] = "Value_" + i;
            }

            strValueArr = new DictionaryEntry[_hsh2.Count];
            _hsh2.CopyTo(strValueArr, 0);
            //ContainsXXX
            hsh3 = new Hashtable();
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                Assert.True(_hsh2.Contains("Key_" + i));
                Assert.True(_hsh2.ContainsKey("Key_" + i));
                Assert.True(_hsh2.ContainsValue("Value_" + i));

                //we still need a way to make sure that there are all these unique values here -see below code for that
                Assert.True(hsh1.ContainsValue(((DictionaryEntry)strValueArr[i]).Value));

                hsh3.Add(strValueArr[i], null);
            }

            hsh4 = (Hashtable)_hsh2.Clone();

            Assert.Equal(hsh4.Count, hsh1.Count);
            strValueArr = new DictionaryEntry[hsh4.Count];
            hsh4.CopyTo(strValueArr, 0);
            //ContainsXXX
            hsh3 = new Hashtable();
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                Assert.True(hsh4.Contains("Key_" + i));
                Assert.True(hsh4.ContainsKey("Key_" + i));
                Assert.True(hsh4.ContainsValue("Value_" + i));

                //we still need a way to make sure that there are all these unique values here -see below code for that
                Assert.True(hsh1.ContainsValue(((DictionaryEntry)strValueArr[i]).Value));

                hsh3.Add(((DictionaryEntry)strValueArr[i]).Value, null);
            }

            Assert.False(hsh4.IsReadOnly);
            Assert.True(hsh4.IsSynchronized);

            //Phew, back to other methods
            idic = _hsh2.GetEnumerator();
            hsh3 = new Hashtable();
            hsh4 = new Hashtable();
            while (idic.MoveNext())
            {
                Assert.True(_hsh2.ContainsKey(idic.Key));
                Assert.True(_hsh2.ContainsValue(idic.Value));
                hsh3.Add(idic.Key, null);
                hsh4.Add(idic.Value, null);
            }

            hsh4 = (Hashtable)_hsh2.Clone();
            strValueArr = new DictionaryEntry[hsh4.Count];
            hsh4.CopyTo(strValueArr, 0);
            hsh3 = new Hashtable();
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                Assert.True(hsh4.Contains("Key_" + i));
                Assert.True(hsh4.ContainsKey("Key_" + i));
                Assert.True(hsh4.ContainsValue("Value_" + i));

                //we still need a way to make sure that there are all these unique values here -see below code for that
                Assert.True(hsh1.ContainsValue(((DictionaryEntry)strValueArr[i]).Value));

                hsh3.Add(((DictionaryEntry)strValueArr[i]).Value, null);
            }

            Assert.False(hsh4.IsReadOnly);
            Assert.True(hsh4.IsSynchronized);

            //Properties
            Assert.False(_hsh2.IsReadOnly);
            Assert.True(_hsh2.IsSynchronized);
            Assert.Equal(_hsh2.SyncRoot, hsh1.SyncRoot);

            //we will test the Keys & Values
            string[] strValueArr11 = new string[hsh1.Count];
            strKeyArr = new string[hsh1.Count];
            _hsh2.Keys.CopyTo(strKeyArr, 0);
            _hsh2.Values.CopyTo(strValueArr11, 0);

            hsh3 = new Hashtable();
            hsh4 = new Hashtable();
            for (int i = 0; i < _iNumberOfElements; i++)
            {
                Assert.True(_hsh2.ContainsKey(strKeyArr[i]));
                Assert.True(_hsh2.ContainsValue(strValueArr11[i]));

                hsh3.Add(strKeyArr[i], null);
                hsh4.Add(strValueArr11[i], null);
            }

            //now we test the modifying methods
            _hsh2.Remove("Key_1");
            Assert.False(_hsh2.ContainsKey("Key_1"));
            Assert.False(_hsh2.ContainsValue("Value_1"));

            _hsh2.Add("Key_1", "Value_1");
            Assert.True(_hsh2.ContainsKey("Key_1"));
            Assert.True(_hsh2.ContainsValue("Value_1"));

            _hsh2["Key_1"] = "Value_Modified_1";
            Assert.True(_hsh2.ContainsKey("Key_1"));
            Assert.False(_hsh2.ContainsValue("Value_1"));
            ///////////////////////////

            Assert.True(_hsh2.ContainsValue("Value_Modified_1"));
            hsh3 = Hashtable.Synchronized(_hsh2);

            //we are not going through all of the above again:) we will just make sure that this syncrnized and that 
            //values are there
            Assert.Equal(hsh3.Count, hsh1.Count);
            Assert.True(hsh3.IsSynchronized);

            _hsh2.Clear();
            Assert.Equal(_hsh2.Count, 0);

            //[] Synchronized returns a HT that is thread safe
            // We will try to test this by getting a number of threads to write some items
            // to a synchronized IList
            hsh1 = new Hashtable();
            _hsh2 = Hashtable.Synchronized(hsh1);

            workers = new Task[iNumberOfWorkers];
            for (int i = 0; i < workers.Length; i++)
            {
                var name = "Thread worker " + i;
                ts1 = new Action(() => AddElements(name));
                workers[i] = Task.Run(ts1);
            }

            Task.WaitAll(workers);

            //checking time
            Assert.Equal(_hsh2.Count, _iNumberOfElements * iNumberOfWorkers);

            for (int i = 0; i < iNumberOfWorkers; i++)
            {
                for (int j = 0; j < _iNumberOfElements; j++)
                {
                    strValue = "Thread worker " + i + "_" + j;
                    Assert.True(_hsh2.Contains(strValue));
                }
            }

            //I dont think that we can make an assumption on the order of these items though
            //now we are going to remove all of these
            workers = new Task[iNumberOfWorkers];
            for (int i = 0; i < workers.Length; i++)
            {
                var name = "Thread worker " + i;
                ts1 = new Action(() => RemoveElements(name));
                workers[i] = Task.Run(ts1);
            }

            Task.WaitAll(workers);

            Assert.Equal(_hsh2.Count, 0);
            Assert.False(hsh1.IsSynchronized);
            Assert.True(_hsh2.IsSynchronized);

            //[] Tyr calling Synchronized with null
            Assert.Throws<ArgumentNullException>(() =>
                             {
                                 Hashtable.Synchronized(null);
                             }
            );
        }
예제 #13
0
 // Implement the ICollection interface.
 public void CopyTo(Array array, int index)
 {
     table.CopyTo(array, index);
 }
예제 #14
0
	public void CopyTo_Empty ()
	{
		Hashtable ht = new Hashtable ();
		Assert.AreEqual (0, ht.Count, "Count");
		object[] array = new object [ht.Count];
		ht.CopyTo (array, 0);
	}
예제 #15
0
	public void CopyTo_Empty ()
	{
		Hashtable ht = new Hashtable ();
		AssertEquals ("Count", 0, ht.Count);
		object[] array = new object [ht.Count];
		ht.CopyTo (array, 0);
	}
예제 #16
0
        public void TestCopyToBasic()
        {
            Hashtable hash = null;        // the hashtable object which will be used in the tests
            object[] objArr = null;        // the object array corresponding to arr
            object[] objArr2 = null;        // helper object array
            object[,] objArrRMDim = null;       // multi dimensional object array

            // these are the keys and values which will be added to the hashtable in the tests
            object[] keys = new object[] {
                new object(),
                "Hello" ,
                "my array" ,
                new DateTime(),
                new SortedList(),
                typeof( System.Environment ),
                5
            };

            object[] values = new object[] {
                "Somestring" ,
                new object(),
                new int [] { 1, 2, 3, 4, 5 },
                new Hashtable(),
                new Exception(),
                new CopyToTests(),
                null
            };

            //[]test normal conditions, array is large enough to hold all elements

            // make new hashtable
            hash = new Hashtable();

            // put in values and keys
            for (int i = 0; i < values.Length; i++)
            {
                hash.Add(keys[i], values[i]);
            }

            // now try getting out the values using CopyTo method
            objArr = new object[values.Length + 2];

            // put a sentinal in first position, and make sure it is not overriden
            objArr[0] = "startstring";

            // put a sentinal in last position, and make sure it is not overriden
            objArr[values.Length + 1] = "endstring";
            hash.Values.CopyTo((Array)objArr, 1);

            // make sure sentinal character is still there
            Assert.Equal("startstring", objArr[0]);
            Assert.Equal("endstring", objArr[values.Length + 1]);

            // check to make sure arr is filled up with the correct elements

            objArr2 = new object[values.Length];
            Array.Copy(objArr, 1, objArr2, 0, values.Length);
            objArr = objArr2;

            Assert.True(CompareArrays(objArr, values));

            //[] This is the same test as before but now we are going to used Hashtable.CopyTo instead of Hasthabe.Values.CopyTo
            // now try getting out the values using CopyTo method
            objArr = new object[values.Length + 2];

            // put a sentinal in first position, and make sure it is not overriden
            objArr[0] = "startstring";

            // put a sentinal in last position, and make sure it is not overriden
            objArr[values.Length + 1] = "endstring";
            hash.CopyTo((Array)objArr, 1);

            // make sure sentinal character is still there

            Assert.Equal("startstring", objArr[0]);
            Assert.Equal("endstring", objArr[values.Length + 1]);

            // check to make sure arr is filled up with the correct elements
            BitArray bitArray = new BitArray(values.Length);
            for (int i = 0; i < values.Length; i++)
            {
                DictionaryEntry entry = (DictionaryEntry)objArr[i + 1];
                int valueIndex = Array.IndexOf(values, entry.Value);
                int keyIndex = Array.IndexOf(keys, entry.Key);

                Assert.NotEqual(-1, valueIndex);
                Assert.NotEqual(-1, keyIndex);
                Assert.Equal(valueIndex, keyIndex);

                bitArray[i] = true;
            }

            for (int i = 0; i < ((ICollection)bitArray).Count; i++)
            {
                Assert.True(bitArray[i]);
            }

            //[] Parameter validation

            //[] Null array

            Assert.Throws<ArgumentNullException>(() =>
                         {
                             hash = new Hashtable();
                             objArr = new object[0];
                             hash.CopyTo(null, 0);
                         }
            );

            //[] Multidimentional array
            Assert.Throws<ArgumentException>(() =>
                         {
                             hash = new Hashtable();
                             objArrRMDim = new object[16, 16];
                             hash.CopyTo(objArrRMDim, 0);
                         }
            );

            //[] Array not large enough
            Assert.Throws<ArgumentException>(() =>
                         {
                             hash = new Hashtable();
                             for (int i = 0; i < 256; i++)
                             {
                                 hash.Add(i.ToString(), i);
                             }

                             objArr = new object[hash.Count + 8];
                             hash.CopyTo(objArr, 9);
                         }
            );


            Assert.Throws<ArgumentException>(() =>
                         {
                             hash = new Hashtable();
                             objArr = new object[0];
                             hash.CopyTo(objArr, Int32.MaxValue);
                         }
            );

            Assert.Throws<ArgumentOutOfRangeException>(() =>
                         {
                             hash = new Hashtable();
                             objArr = new object[0];
                             hash.CopyTo(objArr, Int32.MinValue);
                         }
            );

            //[]copy should throw because of outofrange
            Random random = new Random(-55);
            for (int iii = 0; iii < 20; iii++)
            {
                Assert.Throws<ArgumentOutOfRangeException>(() =>
                                 {
                                     hash = new Hashtable();
                                     objArr = new object[0];
                                     hash.CopyTo(objArr, random.Next(-1000, 0));
                                 }
                );
            }

            //[]test when array is to small to hold all values hashtable has more values then array can hold

            hash = new Hashtable();

            // put in values and keys
            for (int i = 0; i < values.Length; i++)
            {
                hash.Add(keys[i], values[i]);
            }

            // now try getting out the values using CopyTo method into a small array
            objArr = new object[values.Length - 1];
            Assert.Throws<ArgumentException>(() =>
                         {
                             hash.Values.CopyTo((Array)objArr, 0);
                         }
            );

            //[]test when array is size 0
            // now try getting out the values using CopyTo method into a 0 sized array
            objArr = new object[0];
            Assert.Throws<ArgumentException>(() =>
                         {
                             hash.Values.CopyTo((Array)objArr, 0);
                         }
            );

            //[]test when array is null
            Assert.Throws<ArgumentNullException>(() =>
                         {
                             hash.Values.CopyTo(null, 0);
                         }
            );
        }
        public void NonGenericDictionarySource()
        {
            var source = new Hashtable();

            // guid
            var guidValue = new Guid("21EC2020-3AEA-1069-A2DD-08002B30309D");
            source["GuidPty"] = guidValue;
            Assert.AreEqual(guidValue, source.CopyTo<TargetType>().GuidPty);

            source["GuidPty"] = guidValue.ToString();
            Assert.AreEqual(guidValue, source.CopyTo<TargetType>().GuidPty);

            source["GuidPty"] = guidValue.ToByteArray();
            Assert.AreEqual(guidValue, source.CopyTo<TargetType>().GuidPty);

            // int
            source["IntPty"] = 345;
            Assert.AreEqual(345, source.CopyTo<TargetType>().IntPty);

            source["IntPty"] = 345.ToString(CultureInfo.InvariantCulture);
            Assert.AreEqual(345, source.CopyTo<TargetType>().IntPty);

            source["IntPty"] = (long)345;
            Assert.AreEqual(345, source.CopyTo<TargetType>().IntPty);

            source["IntPty"] = int.MaxValue;
            Assert.AreEqual(int.MaxValue, source.CopyTo<TargetType>().IntPty);

            // enum pty
            source["EnumPty"] = TargetType.TestEnum.Three;
            Assert.AreEqual(TargetType.TestEnum.Three, source.CopyTo<TargetType>().EnumPty);

            source["EnumPty"] = TargetType.TestEnum.Three.ToString();
            Assert.AreEqual(TargetType.TestEnum.Three, source.CopyTo<TargetType>().EnumPty);

            source["EnumPty"] = (int)TargetType.TestEnum.Three;
            Assert.AreEqual(TargetType.TestEnum.Three, source.CopyTo<TargetType>().EnumPty);

            source["EnumPty"] = (byte)TargetType.TestEnum.Three;
            Assert.AreEqual(TargetType.TestEnum.Three, source.CopyTo<TargetType>().EnumPty);

            source["EnumPty"] = (long)TargetType.TestEnum.Three;
            Assert.AreEqual(TargetType.TestEnum.Three, source.CopyTo<TargetType>().EnumPty);

            // obj pty
            var obj = new object();
            source["ObjPty"] = obj;
            Assert.AreEqual(obj, source.CopyTo<TargetType>().ObjPty);
        }
예제 #18
0
            // ICollection

            public override void CopyTo(Array array, int arrayIndex)
            {
                host.CopyTo(array, arrayIndex);
            }
 public void ElementAtShouldReturnExpectedValueFromDictionary()
 {
     var target = new Hashtable();
     target.Add( 0, new object() );
     target.Add( 1, new object() );
     target.Add( 2, new object() );
     
     var index = 2;
     var array = Array.CreateInstance( typeof( DictionaryEntry ), 3 );
     target.CopyTo( array, 0 );
     
     var expected = array.GetValue( index );
     var actual = target.ElementAt( index );
     Assert.Equal( expected, actual );
 }