Empty Field
Collapse the table of content
Expand the table of content

EventArgs.Empty Field


Provides a value to use with events that do not have event data.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public static readonly EventArgs Empty

Field Value

Type: System.EventArgs

Pass this value to event handlers that are associated with events that do not have data.

The following example shows a simple counting application that raises an event when a threshold is equaled or exceeded. The Empty field is passed to the OnThresholdReached method.

using System;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            Counter c = new Counter(new Random().Next(10));
            c.ThresholdReached += c_ThresholdReached;

            Console.WriteLine("press 'a' key to increase total");
            while (Console.ReadKey(true).KeyChar == 'a')
                Console.WriteLine("adding one");

        static void c_ThresholdReached(object sender, EventArgs e)
            Console.WriteLine("The threshold was reached.");

    class Counter
        private int threshold;
        private int total;

        public Counter(int passedThreshold)
            threshold = passedThreshold;

        public void Add(int x)
            total += x;
            if (total >= threshold)

        protected virtual void OnThresholdReached(EventArgs e)
            EventHandler handler = ThresholdReached;
            if (handler != null)
                handler(this, e);

        public event EventHandler ThresholdReached;

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft