MailMessageCollection Class
Represents a collection of MailMessage elements.
public class MailMessageCollection : Collection<MailMessage>, IList<MailMessage>, ICollection<MailMessage>, IList, ICollection, IReadOnlyList<MailMessage>, IReadOnlyCollection<MailMessage>, IEnumerable<MailMessage>, IEnumerable
Public Class MailMessageCollection
Inherits Collection(Of MailMessage)
Implements IList(Of MailMessage), ICollection(Of MailMessage), IList, ICollection, IReadOnlyList(Of MailMessage), IReadOnlyCollection(Of MailMessage), IEnumerable(Of MailMessage), IEnumerable
- Inheritance:
- System.ObjectSystem.Collections.ObjectModel.Collection<MailMessage>MailMessageCollection
Implements
Constructors
MailMessageCollection()
Initializes a new instance of the MailMessageCollection class.
MailMessageCollection(IList<MailMessage>)
Initializes a new instance of the MailMessageCollection class from a list of mail messages.
public MailMessageCollection(IList<MailMessage> list)
Public Sub New(list As IList(Of MailMessage))
Parameters
list
- System.Collections.Generic.IList<MailMessage>
List of mail messages
Methods
LazyLoad(Stream, MailMessageFormat)
Lazily yields all messages from the specified file.
public static IEnumerable<MailMessage> LazyLoad(Stream stream, MailMessageFormat format)
Public Shared Function LazyLoad(stream As Stream, format As MailMessageFormat) As IEnumerable(Of MailMessage)
Parameters
stream
- System.IO.Stream
The stream from which the messages will be loaded.
format
- MailMessageFormat
The message collection format.
Returns
- System.Collections.Generic.IEnumerable<MailMessage>
IEnumerable of MailMessage
Exceptions
- System.ArgumentException
File path is null or empty.
- System.ArgumentException
Unknown message collection format.
LazyLoad(String)
Lazily yields all messages from the specified file.
public static IEnumerable<MailMessage> LazyLoad(string filePath)
Public Shared Function LazyLoad(filePath As String) As IEnumerable(Of MailMessage)
Parameters
filePath
- System.String
A relative or absolute path to the file.
Returns
- System.Collections.Generic.IEnumerable<MailMessage>
IEnumerable of MailMessage
Exceptions
- System.ArgumentException
File path is null or empty.
LazyLoad(String, MailMessageFormat)
Lazily yields all messages from the specified file.
public static IEnumerable<MailMessage> LazyLoad(string filePath, MailMessageFormat format)
Public Shared Function LazyLoad(filePath As String, format As MailMessageFormat) As IEnumerable(Of MailMessage)
Parameters
filePath
- System.String
A relative or absolute path to the file.
format
- MailMessageFormat
The message collection format.
Returns
- System.Collections.Generic.IEnumerable<MailMessage>
IEnumerable of MailMessage
Exceptions
- System.ArgumentException
File path is null or empty.
- System.ArgumentException
Unknown message collection format.
Load(Stream, MailMessageFormat)
Loads the collection of all messages from the specified stream.
public static MailMessageCollection Load(Stream stream, MailMessageFormat format)
Public Shared Function Load(stream As Stream, format As MailMessageFormat) As MailMessageCollection
Parameters
stream
- System.IO.Stream
The stream from which the message collection will be loaded.
format
- MailMessageFormat
The message collection format.
Returns
Exceptions
- System.ArgumentNullException
Stream is null.
- System.ArgumentException
Unknown message collection format.
Load(Stream, MailMessageFormat, Int32)
Loads the message at the specific position from the specified stream.
public static MailMessage Load(Stream stream, MailMessageFormat format, int index)
Public Shared Function Load(stream As Stream, format As MailMessageFormat, index As Integer) As MailMessage
Parameters
stream
- System.IO.Stream
The stream from which the message will be loaded.
format
- MailMessageFormat
The message collection format.
index
- System.Int32
Position of the message to be loaded, indexed from zero
Returns
MailMessage instance.
Exceptions
- System.ArgumentNullException
Stream is null.
- System.ArgumentException
Unknown message format.
- System.IndexOutOfRangeException
Message with a given index was not found.
Load(String)
Loads the collection of all messages from the specified file.
public static MailMessageCollection Load(string filePath)
Public Shared Function Load(filePath As String) As MailMessageCollection
Parameters
filePath
- System.String
A relative or absolute path to the file.
Returns
Exceptions
- System.ArgumentException
File path is null or empty.
Load(String, MailMessageFormat)
Loads the collection of all messages from the specified file.
public static MailMessageCollection Load(string filePath, MailMessageFormat format)
Public Shared Function Load(filePath As String, format As MailMessageFormat) As MailMessageCollection
Parameters
filePath
- System.String
A relative or absolute path to the file.
format
- MailMessageFormat
The message collection format.
Returns
Exceptions
- System.ArgumentException
File path is null or empty.
Load(String, MailMessageFormat, Int32)
Loads the message at the specific position from the specified file.
public static MailMessage Load(string filePath, MailMessageFormat format, int index)
Public Shared Function Load(filePath As String, format As MailMessageFormat, index As Integer) As MailMessage
Parameters
filePath
- System.String
A relative or absolute path to the file.
format
- MailMessageFormat
The message collection format.
index
- System.Int32
Position of the message to be loaded, indexed from zero
Returns
MailMessage instance.
Exceptions
- System.ArgumentException
File path is null or empty.
- System.IndexOutOfRangeException
Message with a given index was not found.
Load(String, Int32)
Loads the message at the specific position from the specified file.
public static MailMessage Load(string filePath, int index)
Public Shared Function Load(filePath As String, index As Integer) As MailMessage
Parameters
filePath
- System.String
A relative or absolute path to the file.
index
- System.Int32
Position of the message to be loaded, indexed from zero
Returns
MailMessage instance.
Exceptions
- System.ArgumentException
File path is null or empty.
- System.IndexOutOfRangeException
Message with a given index was not found.
LoadHeaders(Stream, MailMessageFormat)
Loads HeaderCollection for each message from the specified stream.
public static List<HeaderCollection> LoadHeaders(Stream stream, MailMessageFormat format)
Public Shared Function LoadHeaders(stream As Stream, format As MailMessageFormat) As List(Of HeaderCollection)
Parameters
stream
- System.IO.Stream
The stream from which the System.Collections.Generic.List<T> will be loaded.
format
- MailMessageFormat
The message collection format.
Returns
- System.Collections.Generic.List<HeaderCollection>
List of HeaderCollection.
Exceptions
- System.ArgumentNullException
Stream is null.
- System.ArgumentException
Unknown message collection format.
LoadHeaders(String)
Loads HeaderCollection for each message from the specified file.
public static List<HeaderCollection> LoadHeaders(string filePath)
Public Shared Function LoadHeaders(filePath As String) As List(Of HeaderCollection)
Parameters
filePath
- System.String
A relative or absolute path to the file.
Returns
- System.Collections.Generic.List<HeaderCollection>
List of HeaderCollection.
Exceptions
- System.ArgumentException
File path is null or empty.
LoadHeaders(String, MailMessageFormat)
Loads HeaderCollection for each message from the specified file.
public static List<HeaderCollection> LoadHeaders(string filePath, MailMessageFormat format)
Public Shared Function LoadHeaders(filePath As String, format As MailMessageFormat) As List(Of HeaderCollection)
Parameters
filePath
- System.String
A relative or absolute path to the file.
format
- MailMessageFormat
The message collection format.
Returns
- System.Collections.Generic.List<HeaderCollection>
List of HeaderCollection.
Exceptions
- System.ArgumentException
File path is null or empty.
Save(Stream, MailMessageFormat)
Saves the message collection to a stream.
public void Save(Stream stream, MailMessageFormat format)
Public Sub Save(stream As Stream, format As MailMessageFormat)
Parameters
stream
- System.IO.Stream
The stream to save the message collection to.
format
- MailMessageFormat
The message collection format.
Exceptions
- System.ArgumentNullException
Stream is null.
- System.ArgumentException
Unsupported message collection format.
Save(String)
Saves the message collection to a file.
Parameters
filePath
- System.String
A relative or absolute path for the file where message will be saved.
Exceptions
- System.ArgumentException
File path is null or empty.
Save(String, MailMessageFormat)
Saves the message collection to a file.
public void Save(string filePath, MailMessageFormat format)
Public Sub Save(filePath As String, format As MailMessageFormat)
Parameters
filePath
- System.String
A relative or absolute path for the file where message collection will be saved.
format
- MailMessageFormat
The message collection format.
Exceptions
- System.ArgumentException
File path is null or empty.