GetComponent().enabled = true;

I have this line of code:

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {

     private GameObject weapGun;
     private GameObject weapMelee;

     void Awake(){

          weapGun = GameObject.FindGameObjectWithTag("Gun");
          weapMelee = GameObject.FindGameObjectWithTag("Melee");
          Debug.Log(weapGun);
          Debug.Log(weapMelee);

     }
     void Update(){

          if(Input.GetKeyDown("1")){
               weapGun.GetComponent<SpriteRenderer>().enabled = true;
               weapMelee.GetComponent<SpriteRenderer>().enabled = false;
          }

          if(Input.GetKeyDown("2")){
               weapGun.GetComponent<SpriteRenderer>().enabled = false;
               weapMelee.GetComponent<SpriteRenderer>().enabled = true;
          }
     }
}

I get no errors and the Debug.Log()'s return the correct GameObjects, but the "GetComponent().enabled = true/false; are not doing anything? Can anyone please point out my error.

I believe the problem is GetComponent returns a Type therefore it needs to be assigned to a variable.

SpriteRenderer weapGunRenderer = weapGun.GetComponent<SpriteRenderer>();
weapGunRenderer.enabled = true;
SpriteRenderer weapMeleeRenderer = weapMelee.GetComponent<SpriteRenderer>();
weapMeleeRenderer.enabled = false;