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

后端 未结 5 2123
南方客
南方客 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

    This is simply because ArrayList does not expose a method named ToList.

    See this MSDN page for a table view of the members available to you.

    As explained by others, you may access this extension method by importing the Linq library:

    using System.Linq;
    

    Also, see this link for a custom implementation of such, should you desire to implement one.

提交回复
热议问题