For an instance of a type:

var theString = "hello";
var theType = theString.GetType();

From the type itself:

var theType = typeof(string);