wpf - Interlocked.Increment not working with my Get variable name -


i have wpf application , work method play files in different threads

this global variable update ui:

public static int _totalfilessent; 

now because implement inotifypropertychanged in model have this:

public static int totalfilessent {     { return _totalfilessent; }     set     {         _totalfilessent = value;         onstaticlpropertychanged("totalfilessent");     } } 

(i didn't add event function because not relevant here).

so every time update global variable way:

interlocked.increment(ref _totalfilessent ); 

now because need update ui inotifypropertychanged event need use totalfilessent instead of _totalfilessent in way got compilation error:

a property, indexer or dynamic member access may not passed out or ref parameter.

what mean , how can solved ?

you may raise staticpropertychanged event after calling interlocked.increment:

private static int _totalfilessent;  public static int totalfilessent {     { return _totalfilessent; } }  public static void incrementtotalfilessent() {     interlocked.increment(ref _totalfilessent);     onstaticpropertychanged("totalfilessent"); } 

Comments