您好,我是C#开发界的新来者.
Hello, i'm a newcomers of C# development world.
我试图使用C#构建一个简单的应用程序,如下所示:
I was tried to build a simple applications using C# as shown below :
using System; public class coba { static void Main() { double width, height, woodlength, glassarea; string widthstring, heightstring; widthstring = Console.ReadLine(); width = double.Parse(widthstring); heightstring = Console.ReadLine(); height = double.Parse(heightstring); woodlength = 2 * (width + height) * 3.25; glassarea = 2 * (width * height); Console.WriteLine("Besarnya panjang kayu adalah(The length of the wood is) : " + woodlength + " kaki(feet)"); Console.WriteLine("Besarnya luas kaca adalah(The area of the glass is) :" + glassarea + " meterpersegi(squaremeters)"); } }当我尝试对其进行编译时,将显示错误消息,并指出参数名称:solutionDirectory上的值不能为null.我如何解决它,以便我可以编译上面的代码?我需要你的帮助.非常感谢印度尼西亚语.
When i tried to compile it, the Error message are shown and says that the Value cannot be null on Parameter name : solutionDirectory. How do i resolve it so i can compile the above code? I need your help. Thank you so much from Indonesia.
推荐答案
代码没有错. 您还没有解决方案/项目. 示例还提供了.csproj吗? 您不能只运行代码...还需要一个项目文件(.csproj文件).
There's nothing wrong with the code. You just don't have a solution / project yet. Did the sample also provide a .csproj? You can't just run code...you need a project file (.csproj file) too.
如果没有.csproj,则可以创建一个新的C#控制台应用程序,并将Program.cs文件的内容替换为示例代码的文本.
If you don't have a .csproj, you can create a new C# console application and replace the Program.cs file's contents with the text of the sample code.
更多推荐
尝试建立第一个C#应用程序时失败
发布评论