小弟初学C# ,算是边上班边学边用,这段代码是C# 编程指南上的,每次看到下面这种代码,都有些晕乎,这些代码在实际中用的应该不多吧,该怎么学?希望前辈能不吝赐教,谢谢
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication128
{
class Program
{
static void Main(string[] args)
{
GenericList gll = new GenericList();
gll.AddNode(5);
gll.AddNode(4);
gll.AddNode(3);
int intVal = gll.GetLast();
Console.WriteLine(intVal);
}
}
public class GenericList<T>
{
private class Node
{
public Node Next;
public T Data;
}
private Node head = null;
public void AddNode(T t)
{
Node newNode = new Node();
newNode.Next = head;
newNode.Data = t;
head = newNode;
}
public T GetLast()
{
T temp = default(T);
Node current = head;
while (current != null)
{
temp = current.Data;
current = current.Next;
}
return temp;
}
}
}
本电子邮件(包括任何的附件)为本公司保密文件。本文件仅仅可为以上指