// Generics in c#
using System;
using System.Collections.Generic;
using System.Text;
namespace csharpgenerics
{
class Stack<T>
{
private T[] array;
private int index;
public int Max_Size = 50;
public Stack()
{
array = new T[Max_Size];}
public T Pop()
{
if(index == 0)
throw new System.InvalidOperationException("Stack is emply");
return array[--index];
}
public void Push(T item)
Nandhuu SPosted Oct 22, 2007, 3:39 AM
I couldnt get clear idea about the Generic constraint. Can you please explain it in detail. If possible pls send me a mail