title: IsAssignableFrom, IsInstanceOfType and the is keyword, what is the difference?
body: <p>I have an extension method to safe casting objects, that looks like this:</p>
  
  <pre><code>public static T SafeCastAs&lt;T&gt;(this object obj) {
      if (obj == null)
          return default(T);
  
      // which one I should use?
  
      // 1. IsAssignableFrom
      if (typeof(T).IsAssignableFrom(obj.GetType()))
          return (T)obj;
  
      // 2. IsInstanceOfType
      if (typeof(T).IsInstanceOfType(obj))
          return (T) obj;
  
      // 3. is operator
      if (obj is T)
          return (T) obj;
  
      return default(T);
  }
  </code></pre>
  
  <p>As you can see, I have 3 choice, so which one I should to use? Actually what is the difference between <code>IsAssignableFrom</code>, <code>IsInstanceOfType</code>, and <code>is</code> operator? </p>