unity3d C# 調(diào)用C程序封裝結(jié)構(gòu)體函數(shù)
2023/10/30??????點擊:
C#程序定義結(jié)構(gòu)圖的方式如下:
public struct student //結(jié)構(gòu)體名 { //沒有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; } }
如果結(jié)構(gòu)體內(nèi)定義了靜態(tài)成員或者函數(shù), 則調(diào)用時只會被初始化次, 如:
static student() { Console.WriteLine("我是靜態(tài)函數(shù)"); }結(jié)構(gòu)體實例化方法:
student boy1 = new Student("小明","男", 18); student boy2 = boy1;
- 上一篇:UNITY3D C#調(diào)用C封裝的函數(shù)庫方法 2023/10/30
- 下一篇:元宇宙元宇宙三大技術(shù)階段數(shù)字孿生數(shù)字伴生數(shù)字原生 2023/8/10