fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. var x = new RType1();
  8. Console.WriteLine(x.Value);
  9. }
  10.  
  11. public class RType1
  12. {
  13. public string Value { get;set; }
  14.  
  15. public RType1()
  16. {
  17. Value = "Initial Value";
  18. var r2 = new RType2();
  19. r2.DoSomething(this);
  20. }
  21. }
  22.  
  23. public class RType2
  24. {
  25. public RType2()
  26. {
  27.  
  28. }
  29.  
  30. public void DoSomething(RType1 r1)
  31. {
  32. r1.Value = "New Value";
  33. }
  34. }
  35. }
Success #stdin #stdout 0.02s 33728KB
stdin
Standard input is empty
stdout
New Value