Warning message with virtual event
<p>I want to use virtual event &amp; override it in derive class. Following is the code snippet, I get a warning message while declaring the virtual event.</p>

<pre><code>                using System;
                using System.Collections.Generic;
                using System.Linq;
                using System.Text;

                namespace ConsoleApplication6
                {
                    class Program
                    {
                        static void Main(string[] args)
                        {
                            DeriveClass obj = new DeriveClass();
                            obj.myEvent += new EventHandler(obj_myEvent);
                            obj.MyFunction();

                            Console.ReadLine();
                        }

                        static void obj_myEvent(object sender, EventArgs e)
                        {
                            Console.WriteLine("Event fired.....");
                        }
                    }

                    public abstract class BaseClass
                    {
                        // I get warning on this line - Warning 1   The event 'ConsoleApplication6.BaseClass.myEvent' is never used Program.cs
                        public virtual event EventHandler myEvent;
                    }

                    public class DeriveClass : BaseClass
                    {
                        public override event EventHandler myEvent;

                        public void MyFunction()
                        {
                            if (myEvent != null)
                            {
                                myEvent(this, null);
                            }
                        }
                    }
                }
</code></pre>

<p>Can anybody please tell me how to resolve this warning?</p>

<p>Atul Sureka</p>
