Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12433533
  • 博文数量: 1293
  • 博客积分: 13501
  • 博客等级: 上将
  • 技术积分: 17974
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-08 18:11
文章分类

全部博文(1293)

文章存档

2019年(1)

2018年(1)

2016年(118)

2015年(257)

2014年(128)

2013年(222)

2012年(229)

2011年(337)

分类: C#/.net

2015-01-28 11:49:18


  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Collections;
  6. namespace TestArrayList
  7. {
  8.     class Program
  9.     {
  10.         public struct SData
  11.         {
  12.             public int Index;
  13.             public string Content;
  14.         }
  15.         static void Main(string[] args)
  16.         {
  17.             ArrayList aList = new ArrayList();
  18.             SData d0 = new SData();
  19.             d0.Index = 0;
  20.             d0.Content = "d0";
  21.             aList.Add(d0);
  22.             SData d1 = new SData();
  23.             d1.Index = 1;
  24.             d1.Content = "d1";
  25.             aList.Add(d1);
  26.             SData d2 = new SData();
  27.             d2.Index = 2;
  28.             d2.Content = "d2";
  29.             aList.Add(d2);
  30.             foreach (SData d in aList)
  31.             {
  32.                 Console.WriteLine("Index={0} Content={1}", d.Index, d.Content);
  33.             }
  34.             Console.WriteLine();
  35.             Console.ReadLine();
  36.         }
  37.     }
  38. }



引用命令空间:

using System.Collections;

 

效果图:

image

 

参考文献:

http://blog.sina.com.cn/s/blog_6fd3ad020100ndyt.html

阅读(1923) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~