当前位置:首页 > 开发 > C# > 正文内容

C# 结构体struct 例子

C#3年前 (2022-10-23)
/// <summary>
/// 结构体
/// </summary>
struct MyStruct
{
    public string Name;
    public int Age;
}
static void Main(string[] args)
{
    MyStruct myStruct = new MyStruct();
    myStruct.Name = "无尽的华尔兹";
    myStruct.Age = 25;
    Console.WriteLine(myStruct.Name);
    Console.WriteLine(myStruct.Age);
    Console.Read();
}


转载请注明出处。

本文链接:http://www.pythonopen.com/?id=221

相关文章

C# 一行代码交换变量

int a = 10 ; int b ...

C# 热键

API     /// <summary>...

C# BackgroundWorker

1.概述BackgroundWorker是一个在 WinForms 应用程序中用于简化在后台线程执行...

C# double转为string并保留两位小数

在 C# 中,可以使用多种方式将 double 类型的数据转换为 string 类型并保留两位小数,...

C# Byte[]转为Bitmap

在 C# 中,可以使用System.Drawing命名空间下的相关类将byte[]类型的数据转换为B...

C# Control防闪烁

SetStyle(ControlStyles.AllPaintingInWmPaint |...