title: How can modify the same variable when I pass it as parameter on a method?
body: <p>Well, I have to classes, ClassA is the main class and the ClassB is the auxiliar class. the code is this.</p>
  
  <pre><code>class ClassA
  {
      private void myMthod()
      {
          MyClassB myClassB = new ClasB();
          CustomObject myCustomObject = new CustomObject();
          myClassB.MyMethodOnClassB(myCustomObject);
  
          if(miCustomObject == null)
          {
               //code in case of null
          }
          else
          {
              //code in case of not null
          }
      }
  }
  
  
  class ClassB
  {
      CustomObject _myCustomObjectOnB;
  
      public ClassB(CustomObject paramCustomObject)
      {
          _myCustomObjectOnB = paramCustomObject;
      }
  
      public MyMethodOnClassB()
      {
          _myCustomObject = null;
      }
  }
  </code></pre>
  
  <p>Well, the idea is that when I set to null the variable _myCustomObject on ClassB, in the ClassA myCustomObject would be null. But I know that in this case the code does not work because in the ClassB I am modify a reference different to the reference of the variable on the classA.</p>
  
  <p>The idea is to modify the same reference, because I would like to create a dialog in an application that use the MVVM pattern and I would like to use CustomObject as communication variable, as result of the dialog.</p>
  
  <p>Thank so much.</p>