C# 枚举(enum)特性 2023-01-19 18 笔记 ```csharp using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player : MonoBehaviour { // Start is called before the first frame update enum Gender { male, female = 8, unkonw } void Start() { print((int)Gender.male); } // Update is called once per frame void Update() { } } ``` 枚举中的项实际上可以表示为从0开始的整数,当给其中一项赋值为n时,其后一项会变为n+1。 本文链接: https://shrinken.pw/crash-2023-01-19_52-fml.html