出于某种原因,当我尝试使用 Visual Studio 命令提示符将 .cs 文件编译为 .dll 时,由于某种原因尝试编译时出现新行常量错误
.
它不喜欢 + foot"后面的分号
。
知道为什么吗?
这是我的代码:
/* 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";
}
}
最佳答案
脚前需要另一个“
public string Message()
{
return "The height of tree1 is:<br/>" + tree1.height + "feet";
}
编辑:它实际上是在提示最后一个以“; 开头的字符串没有终止。
关于尝试编译时 C# 换行常量错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3689917/