Class ImapMessageSet
Represents a set of IMAP messages addressed by sequence number or
UID (RFC 9051 §9). Produces the compact command-string form with
range collapsing (e.g. 1,2,3 → 1:3).
Inherited Members
Namespace: DRIT.Mail.Rfc.Imap
Assembly: DRIT.Mail.dll
Syntax
public sealed class ImapMessageSet
Properties
View SourceIsUid
Gets a value indicating whether this set addresses messages by
UID (true) or by sequence number (false).
Declaration
public bool IsUid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceAll()
Creates a set matching all messages (1:*).
Declaration
public static ImapMessageSet All()
Returns
| Type | Description |
|---|---|
| ImapMessageSet |
FromSequenceNumbers(IEnumerable<long>)
Creates a set from a collection of sequence numbers.
Declaration
public static ImapMessageSet FromSequenceNumbers(IEnumerable<long> numbers)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<long> | numbers | Specifies the numbers value. |
Returns
| Type | Description |
|---|---|
| ImapMessageSet |
FromUids(IEnumerable<long>)
Creates a set from a collection of UIDs. Produces a
UID FETCH / UID STORE / UID SEARCH command.
Declaration
public static ImapMessageSet FromUids(IEnumerable<long> uids)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<long> | uids | Specifies the uids value. |
Returns
| Type | Description |
|---|---|
| ImapMessageSet |
Range(long, long)
Creates a set containing a contiguous range of messages.
Declaration
public static ImapMessageSet Range(long from, long to)
Parameters
| Type | Name | Description |
|---|---|---|
| long | from | The first number (inclusive). Use |
| long | to | The last number (inclusive). Use |
Returns
| Type | Description |
|---|---|
| ImapMessageSet |
Single(long)
Creates a set containing a single message.
Declaration
public static ImapMessageSet Single(long number)
Parameters
| Type | Name | Description |
|---|---|---|
| long | number | The 1-based sequence number or UID. |
Returns
| Type | Description |
|---|---|
| ImapMessageSet |
ToCommandString()
Returns the command-string form (e.g. 1, 1:5,
2,4,6, 1:*).
Declaration
public string ToCommandString()
Returns
| Type | Description |
|---|---|
| string |