![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
using System.Threading;
using System.Reflection;
using System.Data;
namespace TestArray
{
class Program
{
//测试顺序存储类
static void Main(string[] args)
{
string s1 = "red";
string s2 = "blue";
string s3 = "yellow";
SeqStructure<string> s = new SeqStructure<string>(3);
s.AddData(s1);
s.AddData(s2);
s.AddData(s3);
s.DisplayData();
Console.ReadLine();
}
}
/// <summary>
/// 数据元素,关系的存储表示及算法实现
/// </summary>
/// <typeparam name="T"></typeparam>
class SeqStructure<T>
{
T[] data; //T代表数据元素的存储表示,数组代表数据元素顺序存放
int i;
public SeqStructure(int size)
{
data = new T[size];
}
public void AddData(T var)
{
data[i++] = var;
}
public void DisplayData()
{
for (int j = 0; j < data.Length; j++)
{
Console.Write(data[j] + "");
}
}
}
}