0

I want to make a clone of an ObservableCollection (so recursive)

I was doing it with automapper with this simple configuration

var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap<HierarchyNodeModel, HierarchyNodeModel>()
            });

and my object:

MyObj = mapper.Map<ObservableCollection<HierarchyNodeModel>, ObservableCollection<HierarchyNodeModel>>(xx);

i upgraded automapper and now it goes on stackoverflow error...

what can i do in alternative to clone my collection?

stef
  • 45
  • 6
  • Try `PreserveReferences`. If that doesn't work, a repro would help. Make a [gist](https://gist.github.com/lbargaoanu/9c7233441c3a3413cc2b9b9ebb5964a9) that we can execute and see fail. – Lucian Bargaoanu Dec 16 '22 at 15:22

0 Answers0