There is no implicit reference conversion


  • I have some Interface

    namespace ClassLibrary.Interfaces
        public interface IFinalElement
            List<Path> AddAllPathC (Point startPoint);

    I have some class

     namespace ClassLibrary
        public class HoleForSelC:CanvasPath,IFinalElement

          public List<Path> AddAllPathC(Point startPoint)
                var listPath = new List<Path>();           

                return listPath;


    In other class I have

    namespace ClassLibrary
        public class FuturePath
      public static void CreatingFinalPathC<TFinalPath>(Canvas canvas, FutureHelpPoint futureHelpPoint, Point startPoint, RealPath realPath)
                where TFinalPath:class,IFinalElement, new()
                 TFinalPath allPath = new TFinalPath();           
                FuturePath.ListFP = allPath.AddAllPathC(startPoint);


    When I try do this 

     FuturePath.CreatingFinalPathC<HoleForSel>(cvAcsonom, futureHelpPoint, RoutingPoint.GetRoutingPoint, realPath);

    I have Exeption

    Severity Code Description Project File Line Suppression State
    Error CS0311 The type 'ClassLibrary.VentSystem.HoleForSel' cannot be used as type parameter 'TFinalPath' in the generic type or method 'FuturePath.CreatingFinalPathC<TFinalPath>(Canvas, FutureHelpPoint, Point, RealPath)'. There is no implicit reference conversion from 'ClassLibrary.VentSystem.HoleForSel' to 'ClassLibrary.Interfaces.IFinalElement'. VentCad J:\Visual Studio\VentCad\VentCad\VentCad\MainWindow.xaml.cs 939 Active

    What's wron???

    Wednesday, April 12, 2017 4:03 PM


  • Sure its not just a typo?

    Your class is called HoleForSelC but you have HoleForSel (no 'C') in your call to FuturePath.CreateFinalPathC<HoldForSel>();

    • Marked as answer by Ahlompys Wednesday, April 12, 2017 8:23 PM
    Wednesday, April 12, 2017 4:16 PM