Chnging the opacity of a sprite not working

I am trying the change the opacity of a sprite using the color property on the sprite. This is the code(c#):

ghostPart.gameObject.GetComponent<SpriteRenderer>().color.a = 0.5f;

but is comes up with error:
Cannot modify a value type return value of ‘UnityEngine.SpriteRenderer.color’.

You can only write code like that in Unityscript; in C# you must supply the entire color.