My CodeSmith-generated hashtable throws an exception in a case when Hashtable does not.
When I use CodeSmith to generate a StringCarHashtable class where the keys are of type string and the values are of type Car (a class), the following code throws an ArgumentException.
StringCarHashtable stringCarHashtable = new StringCarHashtable();
string[] stringArray = new string[ stringCarHashtable.Keys.Count ];
stringCarHashtable.Keys.CopyTo( stringArray, 0 );
When I replace StringCarHashtable with Hashtable, no exception is thrown.
The exception throw when StringCarHashtable is used is as follows:
Unhandled Exception: System.ArgumentException: Argument must be less than array length.
Parameter name: arrayIndex
at ConsoleApplication1.StringCarHashtable.CheckTargetArray(Array array, Int32 arrayIndex) in d:\visualstudioprojects\consoleapplication1\class3.cs:line 2443
Kyle Blaney