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;
}
}
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;
}
}