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

后端 未结 5 2124
南方客
南方客 2021-02-11 14:23

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

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


        
5条回答
  •  无人及你
    2021-02-11 15:27

    The ToList method you are looking for is an extension method. Try adding this using directive to the top of your file:

    using System.Linq;
    

    By adding this using directive you are indicating to the compiler that any extension methods in that namespace should be imported. It's kind of a shame that there isn't more help from Visual Studio around importing extension methods (ReSharper does this rather nicely).

提交回复
热议问题