Blog Home  Home RSS 2.0 Atom 1.0 CDF  
Random Bits! - Anonymous Delegates
Rakesh Ravuri's blog
 
 Monday, March 14, 2005

I was playing around with the new anonymous delegates feature of the Visual Studio 2005 (widbey), I wondered if i could use the this to write for age old data structures in different way, and here is the result!

class ADStack<T>
{

     delegate T popdelegate();
     private popdelegate popper=null;
     public T Pop()
     {

          return popper();
     }

     public void Push(T value)
     {
          popdelegate oldpopper = popper;
          popper =
delegate{
                popper = oldpopper;
                return value;
          };
     }

}

 

3/14/2005 8:25:19 PM (India Standard Time, UTC+05:30)  #    Comments [0]   .NET  |  Trackback
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Copyright © 2008 Rakesh Ravuri. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: