使用直观的类似于使用过的CAE进行逻辑搭建,
首先需要新建站、页,配置接口的时候从数据库的接口需要 计算机点名。该软件通信通过dll文件进行配置。
修改生成dll文件即新增逻辑块需要使用c#。安装完毕c#后,尝试编写运行helloworld
选择新建——项目net.core
选择控制台应用
名称以及后续的全部使用helloword
代码自动生成。
点击运行,出现命令行窗口
helloworld
这几天学习了c#语言的一部分包括认识基本的语法,循环许菊以及表示。
首先是c#de程序结构,
一个 C# 程序主要包括以下部分:
命名空间声明(Namespace declaration)
一个 class
Class 方法
Class 属性
一个 Main 方法
语句(Statements)& 表达式(Expressions)
注释
也就四程序的第一行 using System; - using 关键字用于在程序中包含 System 命名空间。 一个程序一般有多个 using 语句。
下一行是 namespace 声明。一个 namespace 是一系列的类。HelloWorldApplication 命名空间包含了类 HelloWorld。
下一行是 class 声明。类 HelloWorld 包含了程序使用的数据和方法声明。类一般包含多个方法。方法定义了类的行为。在这里,HelloWorld 类只有一个 Main 方法。
下一行定义了 Main 方法,是所有 C# 程序的 入口点。Main 方法说明当执行时 类将做什么动作。
下一行 /…/ 将会被编译器忽略,且它会在程序中添加额外的 注释。
Main 方法通过语句 Console.WriteLine(“Hello World”); 指定了它的行为。
WriteLine 是一个定义在 System 命名空间中的 Console 类的一个方法。该语句会在屏幕上显示消息 “Hello, World!”。
最后一行 Console.ReadKey(); 是针对 VS.NET 用户的。这使得程序会等待一个按键的动作,防止程序从 Visual Studio .NET 启动时屏幕会快速运行并关闭。
通过学习:
首先对于c#需要先把对象以及对象所需要的变量、类别等描述清楚,使用一些表达式定义函数,最后将高函数表达式赋值给某个结果。进入主程序时主要是显示部分了。
以retangle程序为例:
using System;
namespace RectangleApplication
{
class Rectangle
{
// 成员变量
double length;
double width;
public void Acceptdetails()
{
length = 4.5;
width = 3.5;
}
public double GetArea()
{
return length * width;
}
public void Display()
{
Console.WriteLine("Length: {0}", length);
Console.WriteLine("Width: {0}", width);
Console.WriteLine("Area: {0}", GetArea());
}
}
class ExecuteRectangle
{
static void Main(string[] args)
{
Rectangle r = new Rectangle();
r.Acceptdetails();
r.Display();
Console.ReadLine();
}
}
}
这个程序有很多种改法,首先他的对象访问的形式是public,所以,还可以改为private,此时下面就访问不了了,此时需要:using System;
namespace RectangleApplication
{
class Rectangle
{
//成员变量
private double length;
private double width;
public void Acceptdetails()
{
Console.WriteLine("请输入长度:");
length = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入宽度:");
width = Convert.ToDouble(Console.ReadLine());
}
public double GetArea()
{
return length * width;
}
public void Display()
{
Console.WriteLine("长度: {0}", length);
Console.WriteLine("宽度: {0}", width);
Console.WriteLine("面积: {0}", GetArea());
}
}//end class Rectangle
class ExecuteRectangle
{
static void Main(string[] args)
{
Rectangle r = new Rectangle();
r.Acceptdetails();
r.Display();
Console.ReadLine();
}
}
}
也就是需要重新定义。