how to use GetComponent in c#?

sorry ,my english very pooor
create a 3d text

void Update () {
GetComponent (TextMesh).text = "testtext";
}

this code cant run
how tu modif the text ?
i can use javascript modif this attribute

function Update () {
GetComponent (TextMesh).text =  "testtext";
}

i know
:smile:

TextMesh TheTextObj = (TextMesh)GetComponent(“TextMesh”);

Another type-safe way is to do:

TextMesh textMesh = gameObject.GetComponent( typeof( TextMesh ) ) as TextMesh;