Suppose I need to search with one or two conditions depending on user input. I can write
if (searchSubject)
{
uids = searchUnseen ?
m_imap.Search().Where(Expression.And(
Expression.Subject("string"),
Expression.HasFlag(Flag.Unseen)))
:
m_imap.Search().Where(Expression.Subject("string"));
}
else
{
uids = searchUnseen ?
m_imap.Search().Where(Expression.HasFlag(Flag.Unseen))
:
m_imap.Search().Where(Expression.All());
}
With two possibilities I hardcode 4 pieces, but with 6 there will be 64. Is there a better way?
Here is another (very small) issue. It seems to me there is a typo in Mail.dll help. Description of the MailAddress.Name property contains "Can by null". Probably there should be "Can be null"