I'm sure I'm missing something here, but any particular reason this doesn't work?
public ObservableCollection<object> ItemCollection { get; set; }
private void SetListData<T>(List<T> MyList)
{
ItemCollection = new ObservableCollection<object>(MyList);
}
Is there some value for T where this won't work? I figure collection of objects would cover every case, but it seems not:
Error 2 Argument 1: cannot convert from 'System.Collections.Generic.List
<T>
' to 'System.Collections.Generic.List<object>
'
Changing the signature of the property would cause a whole new set of problems, so changing it to:
ItemCollection = new ObservableCollection<T>(MyList);
doesn't seem like a good solution. Can anyone tell me why my original code doesn't work, and if there is any easy fix?