Adding lights and cameras to scenes with cSharp script

How do I add lights and cameras to scenes using cSharp script.
Here’s how I did it in javascript :

var light005GameObject : GameObject = new GameObject("PointLight005");
light005GameObject.AddComponent(Light); // etc

var camera001GameObject : GameObject = new GameObject("CameraTest");
camera001GameObject.AddComponent(Camera); // etc

it’s almost the same. you don’t declare the type of variable after it, it is declared before.

GameObject light005GameObject = new GameObject();

light005GameObject.name = "light005";

light005GameObject.AddComponent(Light);

And it would be the same for cameras.

WOOT! I got it working with one addition to your code

light005GameObject.AddComponent(Light);

should be

light005GameObject.AddComponent(typeof(Light));

and the same for adding Camera