C# study notes–complex data types, functions and structures
C# study notes–complex data types, functions and structures Basic knowledge of C# language. After learning and practicing the introductory knowledge of C#, learn and practice the basic knowledge of C# language! Involves the basics of the language—some complex data types, as well as classes and structures. Out of simple small program code snippets, Begin to gradually move towards the abstract world of data. come on! C# basic Complex data type Features: A collection of multiple data variables that can be named by yourself Types: enumerations, arrays and structures Enumeration: a collection of integer constants Array: A collection of data stored in sequence of any variable type Structure: a data block composed of data of any variable type enum: Enumerations can conveniently represent various states of objects, and are essentially variables. For example, we can use enumerations to represent the type of monster and the player’s action state (stationary, fighting, injured…) Declaration of enumeration: enum E_MonsterType//Name E_XXX { Normal,//0 Boss,//1 automatically postpones based on the previous value } enum E_PlayerType { Main, Other, } Usage of enumeration types: //Customized enumeration type variable name = default value; (Customized enumeration type. Enumeration item) E_PlayerType playerType = E_PlayerType.Other; if(playerType == E_PlayerType.Main) { Console.WriteLine(“Main player…
C# study notes–complex data types, functions and structures
C# study notes–complex data types, functions and structures Basic knowledge of C# language. After learning and practicing the introductory knowledge of C#, learn and practice the basic knowledge of C# language! Involves the basics of the language—some complex data types, as well as classes and structures. Out of simple small program code snippets, Begin to gradually move towards the abstract world of data. come on! C# basic Complex data type Features: A collection of multiple data variables that can be named by yourself Types: enumerations, arrays and structures Enumeration: a collection of integer constants Array: A collection of sequentially stored data of any variable type Structure: a data block composed of data of any variable type enum: Enumerations can conveniently represent various states of objects, and are essentially variables. For example, we can use enumerations to represent the type of monster and the player’s action state (stationary, fighting, injured…) Declaration of enumeration: enum E_MonsterType//Name E_XXX { Normal,//0 Boss,//1 automatically postpones based on the previous value } enum E_PlayerType { Main, Other, } Usage of enumeration types: //Customized enumeration type variable name = default value; (Customized enumeration type. Enumeration item) E_PlayerType playerType = E_PlayerType.Other; if(playerType == E_PlayerType.Main) { Console.WriteLine(“Main player logic”);…