Outdated code?

I had a script a few years back. I tried to re use it today and found that “.active” no longer works. I tried to use “SetActive” but no luck.

 function Lighten()
 {
     if(lightOn)
     {
         flashlight.GetComponent.<Light>().SetActive = true;
         GetComponent.<ParticleSystem>().enableEmission = true;
         GetComponent.<AudioSource>().PlayOneShot(sound);
     }
     else
     {
         flashlight.GetComponent.<Light>().SetActive = false;
         GetComponent.<ParticleSystem>().enableEmission = false;
     }    
 }

Also if someone could convert this to C# it would be great!

 #pragma strict
 import System.Collections.Generic;
 
 var timer : List.<float>;
 var lighterDuration : float;
 
 var flashlight : Light;
 var candle : ParticleSystem;
 var sound : AudioClip;
   
 var lightOn : boolean = true;
  
   
 function Start ()
 {
     timer = new List.<float>([60.0, 75.0, 90.0, 105.0, 120.0]);//There are the random times used for the lighters duration
 }
   
 function Update ()
 {
     if(Input.GetKeyUp(KeyCode.F))
     {
         if(!lightOn)
         {
             lightOn = true;
             var index : float = timer[Random.Range(0, timer.Count)];//this randomly chooses one of the floats in the List timer
             lighterDuration += Time.time + index;//whenever u hit f lighter duration will = the current time  + the random float chosen in the line directly above this one
         }
              
         else if(lightOn)
         {
             lightOn = false;
         }
     }
          
     if(lighterDuration < Time.time)//above we made lighter duration = current time + a random float once. As time passes it willl eventually be bigger than lighter duration and that will cause lightOn to = false
     {
         lightOn = false;
     }
      
     Lighten();
   
 }
   
 function Lighten()
 {
     if(lightOn)
     {
         flashlight.GetComponent.<Light>().SetActive = true;
         GetComponent.<ParticleSystem>().enableEmission = true;
         GetComponent.<AudioSource>().PlayOneShot(sound);
     }
     else
     {
         flashlight.GetComponent.<Light>().SetActive = false;
         GetComponent.<ParticleSystem>().enableEmission = false;
     }    
 }

You need to use .enabled for components/monobehaviours. SetActive() is a method used to enable/disable GameObjects.

flashlight.GetComponent.<Light>().enabled = true;