Ok, here we go.
Create a simple test class as:
public class Test
{
public string Text { get { return "TEST"; } }
public Test()
{
}
}
Next create a typed collection using ArrayList.cst. Let's call it TestCollection.
Then on a form try:
TestCollection c = new TestCollection();
c.Add(new Test());
comboBox1.DataSource = c;
comboBox1.DisplayMember = "Text";
This will result in an InvalidCastException in ICollection.CopyTo(Array array, int arrayIndex).
Copying the array manually will work. E.g. the following code works without throwing an exception:
TestCollection c = new TestCollection();
c.Add(new Test());
Test[] arr = new Test[c.Count];
c.CopyTo(arr);
comboBox1.DataSource = arr;
comboBox1.DisplayMember = "Text";
Note that a the CSVector.cst template displays the same behaviour.
Thank you very much,
Dejan