C# – What does “T @this” mean in a delegate declaration

cgenerics

I've just added a weak event implementation to a project using Dustin Campbell's WeakEvent class. Although blindly using Code I Found On The Internetâ„¢ is generally a bad idea, it's a far better implementation than what I previously hacked together. It seems to work well so far, but in an effort to understand the code I came across the following:

public class WeakEventHandler<T, E> : IWeakEventHandler<E>
    where T : class
    where E : EventArgs
{
    private delegate void OpenEventHandler(T @this, object sender, E e);
    ...

I'm used to declaring delegates types with just the object sender and EventArgs args arguments, so what does the T @this part achieve? Obviously it is declaring something of WeakEventHandler's T generic type but I've never seen @this before (and googling it is understandably hopeless).

Best Answer

The @this means you can use the keyword this as a variable.

The T is simply the first open generic type of WeakEventHandler<T, E>.