topical media & game development
mashup-amazon-13-13-01-Delegates-simpleAnonymousDelegate.aspx.cs / cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
// Define a delegate type
delegate void myDelegateType();
protected void cmdGo_Click(object sender, EventArgs e)
{
// Declare an anonymous delegate
myDelegateType myDelegate = delegate() {
lblResults.Text = "Anonymous delegate fired";
};
// Invoke the delegate
myDelegate.Invoke();
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.