unity3d C# 调用C程序封装结构体函数
C#程序定义结构图的方式如下:
public struct student //结构体名
{
//没有public 修饰的成员变量 不能被访问
public string Name;
public string Sex;
public int Age;
public student(string name, string sex, int age)
{
this.Name = name;
this.Sex = sex;
this.Age = age;
}
}
如果结构体内定义了静态成员或者函数, 则调用时只会被初始化次, 如:
static student()
{
Console.WriteLine("我是静态函数");
}
结构体实例化方法:
student boy1 = new Student("小明","男", 18);
student boy2 = boy1;
- 上一篇:UNITY3D C#调用C封装的函数库方法 2023/10/30
- 下一篇:元宇宙元宇宙三大技术阶段数字孪生数字伴生数字原生 2023/8/10
