Cannot implicitly convert type 'System.Collections.Generic.List in C#

前端 未结 2 914
孤城傲影
孤城傲影 2021-01-22 01:48

Hi I\'m new to programming, could you please help me with this one:

I\'am getting an error in \"To.List()\" Error 1 Cannot implicitly convert type \'System.Co

2条回答
  •  野性不改
    2021-01-22 02:36

    You are basically trying to assign an anonymous type

    new { d.Key.month, d.Key.year, count = d.Count() }

    to your object. Instead of select new { ... }, just select new IncByYrMonthModel() { ... } to populate your object.

提交回复
热议问题