zoukankan      html  css  js  c++  java
  • List和Enum

    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace ConsoleApplication1
    {
        
    class Program
        {
            
    static void Main(string[] args)
            {
                
    //list<T>
                List<user> ls=new List<user>();
                user us;
                us 
    = new user("a""2");
                ls.Add(us);
                us 
    = new user("b""22");
                ls.Add(us);
                us 
    = new user("c""3");
                ls.Add(us);
                
    foreach (user u in ls)
                {
                    Console.WriteLine(u.Name);
                    Console.WriteLine(u.Age);
                }
                Console.WriteLine(us.i.ToString());
                Console.Read();
            }
          
        }
        
    public class user
        {
            
    public string _a;
            
    public string _b;
            
    //构造函数
            public user(string a,string b )
            {
                
    this._a = a;
                
    this._b = b;
            }
            
    public string Name
            {
                
    get { return _a; }
            }
            
    public string Age
            {
                
    get { return _b; }
            }
            
    //枚举
            enum others
            {
                aaaaa
    =1,
                bbbbb
            }
            
    //调取枚举
           public int i = (int)others.aaaaa;
        }
    }

  • 相关阅读:
    Java 插入排序
    Java 浮点型与双精度数值比较
    Java 包装类Integer的值比较
    ORA-00942 table or view does not exist
    logging模块
    面向对象
    模块和包
    异常处理
    序列化模块
    css3选择器
  • 原文地址:https://www.cnblogs.com/doc/p/1388594.html
Copyright © 2011-2022 走看看