2016-11-09 113 views
0

如何在cloud9中为C#引用mscorlibHello World不适用于Cloud9上的C#

为世界你好的样本代码不起作用

using System; 

public class Hello2 
{ 
    public static void Main() 
    { 
     Console.WriteLine("Hello, World!"); 
    } 
} 

,因为它发出了以下错误:

error: expected nested-name-specifier before ‘System’ using System;
error: ‘System’ has not been declared
error: expected unqualified-id before ‘public’
public class Hello2

+0

只需右键点击引用,那里你可以看到现有的程序集mscorlib –

回答

0

你缺少namespace

using System; 
namespace namespace_name 
{ 
    public class Hello2 
    { 
     public static void Main() 
     { 
      Console.WriteLine("Hello, World!"); 
     } 
    } 
} 
+0

错误:预期的嵌套名称-specifier before'System' using System;错误:'系统'未被声明错误:预期'{'之前'公共' 公共类Hello2错误:预期'公共'之前的非限定id错误:预期'}'在输入结束 –