I have extended a class like so:
public class CormantRadDock : Telerik.Web.UI.RadDock
{
public enum Charts { LineChart, PieChart, BarChart };
public Charts ChartType { get; set; }
public bool LegendEnabled { get; set; }
public string ChartName { get; set; }
public CormantRadDock() : base()
{
}
}
I am now trying to adjust some code elsewhere to accommodate this update.
The old code was this:
List<RadDock> docks = new List<RadDock>(dockLayout.RegisteredDocks);
where RegisteredDocks is of type "System.Collections.ObjectModel.ReadOnlyCollection<RadDock>"
I do not understand why this is not possible:
List<CormantRadDock> docks = new List<CormantRadDock>(dockLayout.RegisteredDocks);
I receive the errors:
The best overloaded method match for ‘System.Collections.Generic.List.List(System.Collections.Generic.IEnumerable)’ has some invalid arguments.
Argument 1: cannot convert from ‘System.Collections.ObjectModel.ReadOnlyCollection’ to ‘System.Collections.Generic.IEnumerable’
Could someone please explain why this is occurring and a best possible solution?
Some of the
RegisteredDocksmight not beCormantRadDock, so they can’t be added to aList<CormantRadDock>.If you’re only interested in the CormantRadDocks, you can filter by type:
If you know for sure that
RegisteredDockswill only contain CormantRadDocks, you can cast each item: