Typeforwarding Generic Types

When you forward a generic type to another assembly [0] using the TypeForwardedTo attribute, you can’t specify the typeparameters. Instead the number of typeparameters in in the class definition depends the number of comma’s in definition.

using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Destination.SomeClass))] // Non generic

[assembly: TypeForwardedTo(typeof(Destination.SomeClass<>))] // equivalent to SomeClass<T>

[assembly: TypeForwardedTo(typeof(Destination.SomeClass<,>))] // equivalent to SomeClass<T,U>

More info on typeforwarding

Posted