unity3d get component

C#
using UnityEngine;

public class GetComponentExample : MonoBehaviour
{
    void Start()
    {
        HingeJoint hinge = gameObject.GetComponent(typeof(HingeJoint)) as HingeJoint;        if (hinge != null)
            hinge.useSpring = false;
    }
}

Source

Also in C#: