MailBee.NET Objects 4.0

EmailAddressCollection.ToString Method 

Returns the string containing all the e-mail addresses in the collection.

public override string ToString();

Return Value

The comma-separated list of the full e-mail addresses (with optional friendly names and remarks) in the collection.

Remarks

By default, the e-mail addresses are delimited with comma (",") character. See AsString topic on how to change the delimiter to semicolon (;).

Example

This sample creates the new collection of the e-mail addresses and displays this collection as string.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

EmailAddressCollection adrs = new EmailAddressCollection();
adrs.AddFromString("jdoe@domain1.com");
adrs.AddFromString("some one <someone@domain2.com>");
adrs.AddFromString("me@host.com (Comment)");
Console.WriteLine(adrs.ToString());

// Output: jdoe@domain1.com, "some one" <someone@domain2.com>, me@host.com (Comment)
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Mime

Dim adrs = New EmailAddressCollection
adrs.AddFromString("jdoe@domain1.com")
adrs.AddFromString("some one <someone@domain2.com>")
adrs.AddFromString("me@host.com (Comment)")
Console.WriteLine(adrs.ToString())

' Output: jdoe@domain1.com, "some one" <someone@domain2.com>, me@host.com (Comment)

See Also

EmailAddressCollection Class | MailBee.Mime Namespace | AsString