I'm using a specific datasource from devexpress called VirtualServerMode. It's a read-only datasource by default. To enable ability to edit data I need to pass collection implementing the IList interface.
I use Dictionary to store different collections.
When I create collection in this way:
Using constructor to initialize the dictionary
protected AbstractRepository()
{
_className = typeof(TCardType).Name;
_acquireList = new Dictionary<string, BindingList<TCardType>>();
_acquireList[_className] = new BindingList<TCardType>();
}
And the property returns the value
public BindingList<TCardType> AcquireList => _acquireList[_className];
The Devexpress component does not recognize the collection and edit mode is not enabled.
If I initialize the dictionary in like this
public IList GreateAcquireList()
{
var outcome = new BindingList<TCardType>();
_acquireList[_className] = outcome;
return outcome;
}
And pass the collection to the datasource
private void FileCardDatasource_AcquireInnerList(object sender, VirtualServerModeAcquireInnerListEventArgs e)
{
e.InnerList = Report.GreateAcquireList();
}
The component recognises the collection and edit mode is enabled.
Why does the dictionary not return a reference to the reference type value?