I tried to insert an object into a generic BindingList. But if I try to add a specific object the compiler says: "Argument type ... is not assignable to parameter type"
private void JoinLeaveItem<T>(BindingList<T> collection)
{
if (collection.GetType().GetGenericArguments()[0] == typeof(UserInformation))
{
var tmp = new UserInformation();
collection.Add(tmp);
}
}
Please help me
UserInformation?GroupInformationandUserInformationrelated to each other? Is there an inheritance hierarchy between them and any other type you want to add to the collection?