From.Contains using IMAP Linq

Feb 23, 2012 at 6:59 AM

Just for anyone else out there who might have run into this problem. I was not able to get the From.Contains (Or any From, To, BCC, CC) to work in my project like so:

var query = client.Messages.Where(x => 
   x.From.Contains("Peter") && x.To.Contains("Mary")).Select(x => x.Envelope);

There was a casting error on Contains, and my solution wouldn't compile. After cracking open the source I found that this extension method was marked internal:

 

namespace Crystalbyte.Equinox.Imap.Linq
{
    internal static class EnumContactExtensions
    {
        public static bool Contains(this IEnumerable list, string value)
        {
            return list.Any(x => x.Contains(value));
        }
    }
}

Changing to public resolved issue.