请帮我解释一下这个关于泛型的代码
using System;using System.Collections.Generic;
using System.Text;
namespace 泛型
{
class Program
{
public static void Main(string[] args)
{
//创建实例并指定类型
GenericList<string>list=new GenericList<string>();
string s="d";
for(int x=0;x<10;x++)
{
list.AddHead(s);
s+="d";
}
foreach(string i in list)
{
Console.Write(i+"");
Console.WriteLine();
}
Console.WriteLine("\n完成\n\n");
Console.Read();
}
public class GenericList<T>
{
private class Node
{
public Node(T t)
{
next=null;
data=t;
}
private Node next;
public Node Next
{
get
{
return next;
}
set
{
next=value;
}
}
private T data;
public T Data
{
get
{
return data;
}
set
{
data=value;
}
}
}
private Node head;
public GenericList()
{
head=null;
}
public void AddHead(T t)
{
Node n=new Node(t);
n.Next=head;
head=n;
}
public IEnumerator<T> GetEnumerator()
{
Node current=head;
while(current!=null)
{
yield return current.Data;
current=current.Next;
}
}
}
}
}