If you call ``++GetType()++`` on a ``++Type++`` variable, the return value will always be ``++typeof(System.Type)++``. So there's no real point in making that call. The same applies to passing a type argument to ``++IsInstanceOfType++``. In both cases the results are entirely predictable.


== Noncompliant Code Example

----
var intType = typeof(int);
var runtimeType = intType.GetType(); // Noncompliant, always typeof(System.RuntimeType)

var s = "abc";
if (s.GetType().IsInstanceOfType(typeof(string))) // Noncompliant; false
{ /* ... */ }
----


== Compliant Solution

----
var s = "abc";

if (s.GetType().IsInstanceOfType("string"))
{ /* ... */ }
----


== Exceptions

----
typeof(Type).GetType(); // Can be used by convention to get an instance of ‘System.RuntimeType’
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
