How to copy ObservableCollection
item to another ObservableCollection
without reference of first collection? Here ObservableCollection
item value changes affecting both collections.
Code
private ObservableCollection<RateModel> _AllMetalRate = new ObservableCollection<RateModel>();
private ObservableCollection<RateModel> _MetalRateOnDate = new ObservableCollection<RateModel>();
public ObservableCollection<RateModel> AllMetalRate
{
get { return this._AllMetalRate; }
set
{
this._AllMetalRate = value;
NotifyPropertyChanged("MetalRate");
}
}
public ObservableCollection<RateModel> MetalRateOnDate
{
get { return this._MetalRateOnDate; }
set
{
this._MetalRateOnDate = value;
NotifyPropertyChanged("MetalRateOnDate");
}
}
foreach (var item in MetalRateOnDate)
AllMetalRate.Add(item);
What is causing this and how can I solve it?