Constraints on explicit interface implementation methods

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    4 posts
    Member since:
    Mar 2016

    Posted 11 Jan 2017 Link to this post

    The following code:

        public interface ITest {
            T GetByType<T>() where T : class;    

        public class Test : ITest {
            T ITest.GetByType<T>() {
                return null;


    Decompiles as:

            T ITest.GetByType<T>()
            where T : class
                return default(T);

    Which gives this compilation error:

    "Constraints for override and explicit interface implementation methods are inherited from the base method, so they cannot be specified directly".


    Note that for implicit interface implementations the constraint should be there.



  2. Adrian
    Adrian avatar
    17 posts

    Posted 17 Jan 2017 Link to this post


    Thanks for reporting this issue. We will investigate it and fix it in future versions. Please stay tuned and update regularly.

    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top