Sprite rotation

so i found this code in JS:

#pragma strict
var X : float;
   function Start () {
         X=transform.localScale.x;
}

function Update () {
if(Input.GetKey("a"))
{
transform.localScale.x=X;
}
else if(Input.GetKey("d"))
{
transform.localScale.x=-X;
}

}

and what i wanted to do is to translate it in C#, it works fine on JS but i just lost 1 hour trying to translate it, the problem is i can not access translate.localScale in C#, what’s the problem? can someone Explain to me what is the difference with transform and Transform (class) and why can’t i see transform when i type in visual studio as a intelisensi ?? thank you!

See NicholasFrancis’s answer in this thread: http://forum.unity3d.com/threads/6404-Cannot-modify-because-it-is-not-a-variable-in-C

You can’t assign values to individual components of transform.localScale in C# (or other transform properties) because of the fact that they are stored as properties. You can, however, read those values, so your line 4 doesn’t need to be modified. Lines 10 and 14 should become the following two lines respectively to function properly in C#:

// line 10
transform.localScale = new Vector3(X, transform.localScale.y, transform.localScale.z);

// line 14
transform.localScale = new Vector3(-X, transform.localScale.y, transform.localScale.z);

The difference with transform and Transform is the following:

Transform (capital T) is a Unity-defined class, while transform (lowercase t) is an instance of that Transform class that is local to the MonoBehaviour-derived script you are working with. This transform (lowercase t again) references the Transform component attached to the same GameObject your MonoBehaviour-derived script is attached to.

If you attach your MonoBehaviour-derived script to several GameObjects, any use of the transform (lowercase t) reference will refer to each GameObject’s respective Transform component for each instance of your script.