System.Array. does not contain a definition for “ToList”

后端 未结 4 2036
被撕碎了的回忆
被撕碎了的回忆 2021-02-11 14:38

I\'m getting the above error on the ToList() line of the code below

if (emailReplyTo != null)
{
  System.Collections.Generic.List replyto
    = ema         


        
4条回答
  •  逝去的感伤
    2021-02-11 15:11

    In case someone stumbles on this questions after googling...

    I had the exact same problem in Razor views and adding using System.Linq at the top didn't help.

    What did help is calling .Cast() before using Linq extension methods:

    myArrayVariable.Cast().ToList() //ok, NOW ToList works fine
    

提交回复
热议问题