Cannot implicitly convert type 'int?' to 'int'.

前端 未结 10 1597
野性不改
野性不改 2021-01-03 19:34

I\'m getting the error \"Cannot implicitly convert type \'int?\' to \'int\'. An explicit conversion exists (are you missing a cast?)\" on my OrdersPerHour at the return line

10条回答
  •  日久生厌
    2021-01-03 20:32

    Check the declaration of your variable. It must be like that

    public Nullable x {get; set;}
    public Nullable y {get; set;}
    public Nullable z {get { return x*y;} }
    

    I hope it is useful for you

提交回复
热议问题