Convert Java to C#

I have a code that I want to convert to C# but I’m having some insues on convertion

This is the Java code, that I found in this answer

#pragma strict
 
private var webcamTexture1 : WebCamTexture;
private var webcamTexture2 : WebCamTexture;
 
var target1 : Transform;
var target2 : Transform;
 
function Start () {
 
webcamTexture1 = WebCamTexture();
webcamTexture2 = WebCamTexture();
 
var devices : WebCamDevice[] = WebCamTexture.devices;
 
    if(devices.length > 1){
        webcamTexture1.deviceName = devices[0].name;
        webcamTexture2.deviceName = devices[1].name;
 
        target1.renderer.material.mainTexture = webcamTexture1;
        target2.renderer.material.mainTexture = webcamTexture2;
 
        webcamTexture1.Play();
        webcamTexture2.Play();
    }
    else
        print("Make sure you got two cams");
}

And this was my try:

using UnityEngine;
using System.Collections;

public class WebCam : MonoBehaviour {

 
private WebCamTexture webcamTexture1;
private WebCamTexture webcamTexture2;
 
Transform target1;
Transform target2;
 
void  Start (){
 
webcamTexture1 = WebCamTexture();
webcamTexture2 = WebCamTexture();
 
WebCamDevice[] devices = WebCamTexture.devices;
 
    if(devices.length > 1){
        webcamTexture1.deviceName = devices[0].name;
        webcamTexture2.deviceName = devices[1].name;
 
        target1.renderer.material.mainTexture = webcamTexture1;
        target2.renderer.material.mainTexture = webcamTexture2;
 
        webcamTexture1.Play();
        webcamTexture2.Play();
    }
    else
        print("Make sure you got two cams");
}

}

Here is the list of error on Unity?

LINK FOR BIGGER IMAGE

On line 15 and 16 you need the ‘new’ keyword:

webcamTexture1 = new WebCamTexture();
webcamTexture2 = new WebCamTexture();

On line 20, Length should be capitalised (Length as apposed to length):

if(devices.Length > 1){

Also you won’t get an error but as variables default to private in C# and public in Unityscript on line 10 and 11 you should add ‘public’ (otherwise they won’t be exposed in the inspector) and if you wanted you could leave out ‘private’ on lines 7 and 8:

WebCamTexture webcamTexture1;
WebCamTexture webcamTexture2;
 
public Transform target1;
public Transform target2;

Scribe