title: how to get reference from property info in c#
body: <p>I need to recursively go through all properties in my class and if the property happens to be a string I need to do some custom logic. Please advise what I need to put at the line of recursion.</p>
  <pre><code>void ProcessAllStrings&lt;T&gt;(ref T objToRip)
  {
      BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
      Type typeParameterType = typeof (T);
  
      foreach (PropertyInfo p in typeParameterType.GetProperties(flags))
      {
          Type currentNodeType = p.PropertyType;
          if (currentNodeType == typeof (String))
          {
              //here I do my custom string handling. Code deleted
          }
              //if non primitive and non string then recurse. (nested/inner class instances)
              // see http://stackoverflow.com/questions/4444908/detecting-native-objects-with-reflection
          else if (currentNodeType != typeof (object) &amp;&amp; Type.GetTypeCode(currentNodeType) == TypeCode.Object)
          {
              //I need to get the reference to this property which happens to be a nested class
              //but propertyInfo only provides GetValue(). No GetReference available..
              ProcessAllStrings(ref &quot;dont know what to put here&quot;);
          }
      }
  }
  </code></pre>