I am having a problem with the following:
public class C<T> where T : class, new() { /* ... */ }
In Cecil, the instance of GenericParameter, that represents T in the
class definition above, does not have the reference type constraint
and the constructor constraint:
public static void Main()
{
AssemblyDefinition assembly =
AssemblyFactory.GetAssembly("parconstrainttest.dll");
GenericParameter t =
assembly.MainModule.Types["C`1"].GenericParameters[0];
Console.WriteLine(t.HasReferenceTypeConstraint); // "False"
Console.WriteLine(t.HasDefaultConstructorConstraint); // "False"
}
Is this a bug, or have I overlooked some of the semantics of
constraints on generic parameters?
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---