converting js to c# help

I need to know what is being called in this snipit of code so i can try and create it in c#.
I normally would just use the javascript myself but i want to do some learning on the c# side of things.

function Update () {

if(Input.GetKey(“escape”)) {
//pause the game
Time.timeScale = 0;
//show the pause menu
var script3 = GetComponent(“PauseMenuScript”);
script3.enabled = true;
//disable the cursor hiding script
var script4 = GetComponent(“HideCursorScript”);
script4.enabled = false;
}
}

mainly i would like to know how you would call var script3 = GetComponent(“PauseMenuScript”);

i’ve done some looking around and i’m not really finding a solid answer to this. Any help would be great.

To get the answer… search the documentation for GameObject.GetComponent… The result will either be in JS or C#, look at the way it is written in JS, then look at the way it is written in C#… very simple. :wink:

JS:
var script3 = GetComponent(“PauseMenuScript”);

C#
PauseMenuScript script3 = gameObject.GetComponent();