3 回答
TA贡献1818条经验 获得超8个赞
class Program
{
static void Main(string[] args)
{
SetSomeValue();
Console.ReadKey();
}
static void SetSomeValue()
{
List<Area> al = GetOrigialList(10).FindAll(
delegate(Area a) { return a.Area_ID > 5; }
);
foreach (Area a in al)
{
a.Area_Name = a.Area_Name + "[修改后的值]";
}
foreach (Area a in al)
{
Console.WriteLine(a.Area_ID.ToString() + "-" + a.Area_Name);
}
}
static List<Area> GetOrigialList(int num)
{
List<Area> al = new List<Area>();
for (int i = 0; i < num; i++)
{
Area a = new Area();
a.Area_ID = i;
a.Area_Name = "" + a.Area_ID + "名";
al.Add(a);
}
return al;
}
}
#region Area
public class Area
{
private int m_Area_ID;
public int Area_ID
{
get { return m_Area_ID; }
set { m_Area_ID = value; }
}
private string m_Area_Name;
public string Area_Name
{
get { return m_Area_Name; }
set { m_Area_Name = value; }
}
}
#endregion
- 3 回答
- 0 关注
- 549 浏览
添加回答
举报