尝试建立第一个C#应用程序时失败

编程入门 行业动态 更新时间:2024-10-21 09:44:07
本文介绍了尝试建立第一个C#应用程序时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,我是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#应用程序时失败

本文发布于:2023-11-16 14:29:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605125.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第一个   应用程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!