So I have this model:
public class Container : INotifyPropertyChanged
{
private int _total;
private static InjectionContainer _mainContainer = new InjectionContainer();
private static InjectionContainer _secondContainer = new InjectionContainer();
private ObservableCollection<MyData> _files = new ObservableCollection<MyData>();
public int TotalPackets
{
get { return _total; }
set
{
_total = value;
OnPropertyChanged("Total");
}
}
public ObservableCollection<MyData> List
{
get { return _files; }
set { _files = value; }
}
}
And outside of this Container
class I want to update my class Total
property but I need it to be thread safe cause many thread do it at the same time:
public static void UpdateTotal(Container container, int value)
{
Interlocked.Add(ref container.Total, value);
}
And got this error:
A property or indexer may not be passed as an out or ref parameter