Type of a script

Hi

I'm wondering how this works (it's c#)

GetComponent<myscriptname>();

I always thought a script would have the type Monoscript, but then one should use

GetComponent<MonoScript>();

and it wouldn't be clear which script is returned. It seems like every script has its unique type. However with a unique type this should cause an error

MonoScript myscript=someobject.GetComponent<myscriptname>();

Can someone please help me and explain what is going on there ?

GetComponent is a function template, if you want to know more about templates in c#: http://en.wikipedia.org/wiki/Template_(programming)

Anyways, `GetComponent();` will return a reference to an object of type "MyScript" and that means that you need to use it like this:

MyScript MyScriptReference = GetComponent<MyScript>();//You can name MyScriptReference as you wish