title: how to use ref to a property in c#
body: <p>I use WPF to write my interface. and I use ListView as my task list.Task list contains two columns,FileName,Progress.every row binding to a TaskInfo:</p>
  
  <pre><code>public class TaskInfo : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
  
      public TaskInfo(string fp)
      {
          FileSystemInfo fsi= new DirectoryInfo(fp);
          FileName = fsi.Name;   
          FilePath = fp;     
          PbValue = 0;
  
      }
      private int pbvalue;
      public int PbValue
      {
          get { return pbvalue; }
          set
          {
              pbvalue = value;
              onPropertyChanged("PbValue");
          }
      }
      private string filename;
      public string FileName
      {
          get { return filename;}
          set
          {
              filename = value;
              onPropertyChanged("FileName");
          }
      }
      private string filepath;
      public string FilePath
      {
          get { return filepath;}
          set
          {
              filepath = value;
              onPropertyChanged("FilePath");
          }
      }
  
      private void onPropertyChanged(string name)
      {
          if (this.PropertyChanged != null)
          {
              this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(name));
          }
      }
  }
  </code></pre>
  
  <p>In Progress column,it contain a ProgressBar,binding its Value to PbValue.
  but But For Some Reason,I should use a Dll writed by C language.
  the function I use is:</p>
  
  <pre><code>WaterErase(char * filepath, int * pbvalue)
  </code></pre>
  
  <p>I definite it in c#:</p>
  
  <pre><code>public extern static void WaterErase(string filepath, ref int pbvalue)
  </code></pre>
  
  <p>to perform multitask, I write a Thread:</p>
  
  <pre><code>class TaskThread
  {
      private TaskInfo taskinfo = null; //task information
      private Thread thread;
      public TaskThread(TaskInfo _taskinfo)
      {
          taskinfo = _taskinfo;
      }
      private void run()
      {   
  
          WaterErase(taskinfo.FilePath, ref taskinfo.PbValue);
  
      }       
      public void start()
      {
          if (thread == null)
          {
              thread = new Thread(run);
              thread.Start();
          }
      }
  }
  </code></pre>
  
  <p>but the line:</p>
  
  <pre><code>WaterErase(taskinfo.FilePath, ref taskinfo.PbValue);
  </code></pre>
  
  <p>have problem:</p>
  
  <blockquote>
    <p>A property, indexer or dynamic member access may not be passed as an out or ref parameter</p>
  </blockquote>
  
  <p>I know why this problem comes up,but how to solve this problem to achieve this function that change the PbValue in real time. So I can perform the task progress in ProgressBar intuitively</p>