using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _10_25_struct
{
class Program
{
struct IS //定义一个结构类型
{
public string w;
public string y;
public string z;
}
static void Main(string[] args)
{
IS ke; //声明结构变量
ke.w = "bz";
ke.y = "kz";
ke.z = "fkz";
Console.WriteLine("w是:{0}",ke.w);//必须加入{0} 否则不会输出w的值.
Console.WriteLine($"y是:{ke.y}"+"\n"+$"z是:{ke.z}"); //"\n"用于换行
Console.ReadLine();
}
}
}
C# ④ 结构类型struct的使用
最新推荐文章于 2023-11-21 18:18:18 发布