0

I have such a class

    public class ClipProcessingGridItem
    {
        public ObservableCollection<MCGeoCalibFolder> GeoCalibrationFolders { get; }
                = new ObservableCollection<MCGeoCalibFolder>();
    }

and now I have List<MCGeoCalibFolder> and I would like to pass this list to ObservableCollection<MCGeoCalibFolder>

Like this

var s = new ClipProcessingGridItem
{
    GeoCalibrationFolders  = GetMyListOfData();
}

How can I do it?

Sirop4ik
  • 4,543
  • 2
  • 54
  • 121

1 Answers1

2

You can use an ObservableCollection<T> constructor accepting a List<T> parameter, like this

var s = new ClipProcessingGridItem
{
    GeoCalibrationFolders = new ObservableCollection<MCGeoCalibFolder>(GetMyListOfData());
}
Pavel Anikhouski
  • 21,776
  • 12
  • 51
  • 66