title: Generic method returning an object instance of T
body: <p>I have same classes but in different namespaces. ex: x.InHeaderType, y.InHeaderType etc...</p>
  
  <p>I have to create instances of these classes with same parameters frequently.</p>
  
  <p>Here is a sample:</p>
  
  <pre><code>x.InHeaderType inHeader = new x.InHeaderType();
  
  inHeader.CompanyId = "TEST";
  inHeader.UserId = "TEST";
  inHeader.Password = "TEST";
  inHeader.MessageId = " ";
  </code></pre>
  
  <p>Is it possible to create a method like:</p>
  
  <pre><code>    public static T GetInHeaderProperty&lt;T&gt;()
      {
          T value;
          // fill the properties of object and return the instance of T
          // I will call it when I need x.InHeaderType or y.InHeaderType
      }
  </code></pre>
  
  <p>Thanks in advance,</p>