Listing all variable object types

I apologise for such a basic question.

I’m getting fairly familiar with Unityscript, but I am starting to work with NGUI so I figured it’s about time I jumped into the world of C#.

I’m already coming to grief, just with declaring variable types - like GameObject etc. I’m trying to capture a script in a variable (using GetComponent). Can anyone tell me what object type this variable needs to be declared as? I’m used to Unityscript where I don’t have to explicitly declare it as anything - the end result being that I don’t know what Unity’s various object types actually are, beyond the basics like GameObject, Camera etc.

I can’t seem to find them in the scripting reference either, which leads me to believe that they are called something other than object types?

Damn, I was starting to make progress too (with Unityscript). Back to the drawing board!

First of all, what component are you getting? Generally, the component type that you are getting will return the particular datatype. For example:

GameObject myObject = GetComponent<GameObject>(); // Returns GameObject data type
Renderer myRenderer = GetComponent<Renderer>(); // Returns Renderer data type
MyScript myScript = GetComponent<MyScript>(); // Returns your script attached to the object
var myVar = GetComponent<MyScript>(); // If you are unsure of the datatype, you can use var

However, if let’s say you are using the other GetComponent which takes in a string…

GameObject myObject = GetComponent("GameObject") as GameObject; // You'll need to define the datatype using as
MyScript myScript = GetComponent("MyScript") as MyScript;
var myVar = GetComponent("MyScript"); // You can still do this with var in C#