Problem when with generic delegates in C#
<p>I have a sample program where I have a class called <code>ObserverTest</code> where I have two methods</p>

<p>one for subscription and one for notify for any type T but I get some build errors.</p>

<p>Following is my sample code></p>

<pre><code>using System;

namespace ConsoleApplication1
{
   class Program
   {
      static void Main(string[] args)
      {
         ObserverTest obs = ObserverTest.Instance();
         obs.SubscribeToChange&lt;int&gt;(GotChange);
         obs.NotifyChange&lt;int&gt;(200);
         Console.ReadLine();
      }

      private static void GotChange(int val)
      {
         Console.WriteLine(string.Format("Changed value is {0}", val));
      }
   }

   public class ObserverTest
   {
      private static ObserverTest _obsTest;
      private Action&lt;T&gt; _observer;

      private ObserverTest()
      {
      }

      public static ObserverTest Instance()
      {
         return _obsTest = _obsTest == null ? new ObserverTest() : _obsTest;
      }

      public void NotifyChange&lt;T&gt;(T val)
      {
         _observer(val);
      }

      public void SubscribeToChange&lt;T&gt;(Action&lt;T&gt; observer)
      {
         _observer = observer;
      }

   }
}
</code></pre>

<p>and followings are the errors:</p>

<pre><code>Error   1   The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs  24  22  ConsoleApplication1

Error   2   The field 'ConsoleApplication1.ObserverTest._observer' cannot be used with type arguments   C:\Users\Administrator\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs  37  10  ConsoleApplication1
</code></pre>

<p>Can anyone please help me in removing the errors ?</p>

<p>Thanks in advance.</p>
