Skip to content

HashTable.CopyTo not working as expected #401

Closed
nanoframework/CoreLibrary
#23
@MatthiasJentsch

Description

@MatthiasJentsch

Details about Problem

nanoFramework area: nanoCLR preview 791

Worked before? No

Detailed repro steps so we can see the same problem

using System.Collections;

namespace NFApp1
{
	public class Program
	{
		public static void Main()
		{
			Hashtable theHashtable = new Hashtable();
			theHashtable.Add(2, 'n');
			theHashtable.Add(3, 'a');
			theHashtable.Add(5, 'n');
			theHashtable.Add(7, 'o');
			theHashtable.Add(11, 'F');
			theHashtable.Add(13, 'r');
			theHashtable.Add(17, 'a');
			theHashtable.Add(19, 'm');
			theHashtable.Add(23, 'e');
			theHashtable.Add(29, 'w');
			theHashtable.Add(31, 'o');
			theHashtable.Add(37, 'r');
			theHashtable.Add(41, 'k');

			object[] c = new object[15];
			theHashtable.CopyTo(c, 2);
		}
	}
}

The expected result should be that c[0] and c[1] are null, because we are copying at start index 2 in the destination array. But c[0] and c[1] are not null.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions