How do you add a component (audio listener) to the main camera through scripting?

How do you add a component (audio listener) to the main camera through scripting?

`gameObject.AddComponent(AudioListener);`

You can access the main camera with Camera.main, so just:

Camera.main.gameObject.AddComponent(AudioListener);

Note that in C# you need to wrap the type in typeof(), e.g.

Camera.main.gameObject.AddComponent(typeof(AudioListener));