![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c#
ParaBama
夕阳西下 你在干啥
展开
-
枚举类型的转换
枚举类型的转换c#下枚举类型和int类型,string类型的转换: 将枚举类型转换为int类型枚举类型和int类型互相兼容,可直接使用强制转换: UserStatus status = UserStatus.OnLine; int n = (int)status; 将int类型转换为枚举类型 int n = 2; UserStatus status = (UserStatus)n; 将string类原创 2017-09-05 00:36:14 · 1160 阅读 · 0 评论 -
c#数组的操作
声明数组声明一个数组会创建若干连续的内存空间,根据数组元素的下标对元素进行操作,数组声明后长度不可更改。int[] nums=new int[10]; //第一种,声明固定长度的数组但不给数组的元素赋值int[] nums2={1,2,3,4,5,6,7,8,9,10}; //直接为数组里的元素赋值修改元素的值nums[2] = 3; //根据元素索引编号进行修改原创 2017-09-05 04:06:46 · 422 阅读 · 0 评论