EDN Admin
Well-known member
Hi C# Connoisseurs,
The following code works in Visual Studio 2012, however in Visual Studio 2010, it doesnt compile:
The type StartEventArgs cannot be used as type parameter TEventArgs in the generic type or method System.EventHandler<TEventArgs>. There is no implicit reference conversion from StartEventArgs to System.EventArgs.
Can you please explain this phenomenon? I mean in Visual Studio 2010, you got to extend from EventArgs "public sealed class StartEventArgs : System.EventArgs, why?
<pre class="prettyprint using System;
public sealed class StartEventArgs
{
}
class Program
{
public event EventHandler<StartEventArgs> Start;
public void Print()
{
Console.WriteLine("Fine!"
}
static void Main()
{
Program prgm = new Program();
prgm.Print();
Console.ReadKey();
}
}
[/code]
Thanks<br/>
View the full article
The following code works in Visual Studio 2012, however in Visual Studio 2010, it doesnt compile:
The type StartEventArgs cannot be used as type parameter TEventArgs in the generic type or method System.EventHandler<TEventArgs>. There is no implicit reference conversion from StartEventArgs to System.EventArgs.
Can you please explain this phenomenon? I mean in Visual Studio 2010, you got to extend from EventArgs "public sealed class StartEventArgs : System.EventArgs, why?
<pre class="prettyprint using System;
public sealed class StartEventArgs
{
}
class Program
{
public event EventHandler<StartEventArgs> Start;
public void Print()
{
Console.WriteLine("Fine!"
}
static void Main()
{
Program prgm = new Program();
prgm.Print();
Console.ReadKey();
}
}
[/code]
Thanks<br/>
View the full article