parsing error on c# do not destroy code

I keep getting a 'parsing error' on line one of this code and I was wondering if anyone has any idea's what is wrong with it. (I am a big noob when it comes to coding)

private static var instance:MyUnitySingleton;
public static function GetInstance() : MyUnitySingleton {
return instance;
}

function Awake() {
if (instance != null && instance != this) {
    Destroy(this.gameObject);
    return;
} else {
    instance = this;
}
DontDestroyOnLoad(this.gameObject);
}

I found the code on another unity answers page here

If you read the post closely, you'll see he says:

"(note that this must be in a file called "MyUnitySingleton" - or, in other words: replace any occurrence of "MyUnitySingleton" with the filename of your script)"

Basically - the name of the Variable (currently MyUnitySingleton) must match the name of the Javascript File - which should be MyUnitySingleton. js. I'm guessing it isn't, which is causing the error.

So you need to make sure the file has the correct name. Alternately, you can rename the Class to match your filename.