I have found some bugs with generics:

Original source code:
public class SomeBase1
{
	public virtual T GetValue<T>() where T : class
	{
		return default(T);
	}
}

public class OtherClass1 : SomeBase1
{
	public override T GetValue<T>()
	{
		return base.GetValue<T>();
	}
}


Generated code:
public class SomeBase1
{
        public virtual T GetValue<T>() where T: class
        {
            return default(T);
        }
}

public class OtherClass1 : SomeBase1
{
        // Error: Constraints for override and explicit interface implementation methods
        // are inherited from the base method, so they cannot be specified directly

        public override T GetValue<T>() where T: class // where not allowed here
        {
            return base.GetValue<T>();
        }
}

best regards,
Jozsef
jozsef.fa
0

Add comment

Please sign in to leave a comment.