title: making a method that checks a generic type, then does the relevant null checks
body: <p>I have a method that is being used to update a record in a database, it accepts some parameters. This method at the beginning calls another method for getting further information about the record with a different call, based on a passed in ID. </p>
  
  <p>What I am trying to do is (please see below) when the <code>UpdateTheRecord</code> method is called, have a second method called <code>CheckValueOrElseGetProperty</code> which allows me to pass in an object return type (such as string, int, etc.), a object argument (to find the property value if an if condition is met, such as <code>string.IsNullOrEmpty</code>), and a lambda expression to specify the property.</p>
  
  <p>In the <code>CheckValueOrElseGetProperty</code> I can use <code>typeof(T)</code> to get the type and execute the checks. But I am unsure of how to call a method with the three generic types, and how to specify the property selection expression. </p>
  
  <p>So, for brevity, let's assume that you have the following method:</p>
  
  <pre><code>public static void UpdateTheRecord(Guid id) {
     MyObjectType myObject = GetFurtherInformation(id);
  
     // call generic method to check "property", 
     // pass in type to do checks, pass in MyObjectType and 
     // with a FUNC specify the property to use if the if condition is met
  }
  </code></pre>
  
  <p>This is where I have issues:</p>
  
  <pre><code>public static T CheckValueOrElseGetProperty&lt;T, TProperty, TReturnType&gt; (Func&lt;T, TProperty&gt; propertySelector) {
       if (typeof(T) is string) {
              // pseudo code
              if (string.IsNullOrEmpty(T)
       }
  }
  </code></pre>