views:

38

answers:

1

For some reason, when I'm trying to compile my .cs file into a .dll using the Visual Studio Command Prompt, I get a new line constant error upon trying to compile for some reason.

It's not liking the semicolon after + feet".

Any idea why?

Here is my code:

/* A simple C# class! */

public class Tree
{
    public int height = 0;

    public void Grow(int h)
    {
        height += h;
    }

    public string Message()
    {
        return "The height of tree1 is:<br/>" + tree1.height + feet";
    }    
}
+3  A: 

You need another " before feet

public string Message()
{
    return "The height of tree1 is:<br/>" + tree1.height + "feet";
}

Edit: It is actually complaining about that the last string starting with "; is not terminated.

Albin Sunnanbo
Hey thanks, wow, I cannot believe I forgot about that. In other code examples I posted I had forgot about it, but nobody mentioned it, so I assumed it was ok :)Thanks!
BOSS
The syntax highlighting is of great help to spot this kind of errors.
Albin Sunnanbo