zoukankan      html  css  js  c++  java
  • 自定义类集合元素遍历 枚举

                Student s = new Student();
                List<Student> list = new List<Student>();        
                s.Height = "19"; 
                s.Weight = "100KG";
                s.Gender = "男";
                list.Add(s);
                //List<int> list = new List<int>();
                //list.Add(1);
                //list.Add(2);
                for (int i = 0; i <list.Count; i++)
                {
                    Console.WriteLine(list[i].Gender);  //注意此处如果想遍历集合中的元素需要使用集合对象.属性
                }
                Console.ReadKey();

     枚举:

    public enum Job

    {

    sit=7,

    speak=30,

    }

    如果枚举中需要较大的数字类型的话使用符号“:” (默认数字类型为int)

    public enum Job:Long

    {

    sit=7,

    speak=300000000000025,

    }

  • 相关阅读:
    第一次用python 写的简单爬虫 记录在自己的博客
    【转】使用notepad运行python
    Android Tools&Cmd
    箴言
    无问西东
    Unity存储路径
    手机屏幕亮度设定
    Go Lang
    iOS .tbd
    Prime31
  • 原文地址:https://www.cnblogs.com/haimingkaifa/p/5266429.html
Copyright © 2011-2022 走看看