Delegate declration
<p>Hi
I have summarized my problem in following code snippet.
In the first code i have declared a delegate and event in the same class while in  <strong>Code 2</strong> i have declared delegate and event in separate class.</p>

<p><strong>Code 1</strong></p>

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

namespace ConsoleApplication1
{
    class Program
    {
        delegate void Greeting(string s);
        event Greeting myEvent;
        void OnFire(string s)
        {
            if (myEvent != null)
                myEvent(s);

        }
        static void Main(string[] args)
        {
            Program obj = new Program();
            obj.myEvent += new Greeting(obj_myEvent);
            obj.OnFire("World");
        }

        static void obj_myEvent(string s)
        {
            Console.WriteLine("Hello " + s + "!");
        }
    }
}
</code></pre>

<p><strong>code 2</strong></p>

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            DelegateDemo obj = new DelegateDemo();
            obj.myEvent+=new DelegateDemo.Greeting(obj_myEvent);
            obj.OnFire("World");
        }

        static void obj_myEvent(string s)
        {
            Console.WriteLine("Hello "+s +"!");
        }
    }
}
</code></pre>

<p><strong>DelegateDemo.cs</strong></p>

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

namespace ConsoleApplication1
{
    public class DelegateDemo
    {
       public delegate void Greeting(string s);
       public event Greeting myEvent;
       public void OnFire(string s)
        {
            if (myEvent != null)
                myEvent(s);

        }
    }
}
</code></pre>

<p>Now i have one question.Is there any diffrence (like thread safe ,performance)  between these two code snippets?</p>
