Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Mail / MailAddressCollection.cs / 1 / MailAddressCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Net.Mail
{
using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Text;
using System.Net.Mime;
public class MailAddressCollection: Collection {
public MailAddressCollection(){
}
public void Add(string addresses) {
if (addresses == null) {
throw new ArgumentNullException("addresses");
}
if (addresses == string.Empty) {
throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "addresses"), "addresses");
}
ParseValue(addresses);
}
/*
// Consider removing.
internal void Populate(string[] addresses) {
if (addresses == null) {
throw new ArgumentNullException("addresses");
}
if (addresses.Length == 0) {
throw new ArgumentException(SR.GetString(SR.net_emptystringcall, "addresses"), "addresses");
}
ParseValue(addresses);
}
*/
protected override void SetItem(int index, MailAddress item){
if(item==null) {
throw new ArgumentNullException("item");
}
base.SetItem(index,item);
}
protected override void InsertItem(int index, MailAddress item){
if(item==null){
throw new ArgumentNullException("item");
}
base.InsertItem(index,item);
}
/*
// Consider removing.
internal bool IsChanged {
get {
return this.isChanged;
}
set {
this.isChanged = value;
}
}
*/
/*
// Consider removing.
internal void ParseValue(string[] addresses) {
for (int i = 0; i < addresses.Length; i++) {
int offset = 0;
MailAddress address = MailBnfHelper.ReadMailAddress(addresses[i],ref offset);
if (address == null)
break;
this.Add(address);
}
}
*/
internal void ParseValue(string addresses) {
for (int offset = 0; offset < addresses.Length; offset++) {
MailAddress address = MailBnfHelper.ReadMailAddress(addresses, ref offset);
if (address == null)
break;
this.Add(address);
if (!MailBnfHelper.SkipCFWS(addresses, ref offset) || addresses[offset] != ',')
break;
}
}
internal string ToEncodedString() {
bool first = true;
StringBuilder builder = new StringBuilder();
foreach (MailAddress address in this) {
if (!first) {
builder.Append(", ");
}
builder.Append(address.ToEncodedString());
first = false;
}
return builder.ToString();;
}
public override string ToString() {
bool first = true;
StringBuilder builder = new StringBuilder();
foreach (MailAddress address in this) {
if (!first) {
builder.Append(", ");
}
builder.Append(address.ToString());
first = false;
}
return builder.ToString();;
}
/*
// Consider removing.
internal string ToAddressString() {
bool first = true;
StringBuilder builder = new StringBuilder();
foreach (MailAddress address in this) {
if (!first) {
builder.Append(", ");
}
builder.Append(address.Address);
first = false;
}
return builder.ToString();;
}
*/
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CalendarDateRange.cs
- TextContainerChangeEventArgs.cs
- PrimitiveXmlSerializers.cs
- BindingContext.cs
- InvalidAsynchronousStateException.cs
- ObjectMemberMapping.cs
- BaseCollection.cs
- AffineTransform3D.cs
- WebPartTransformerCollection.cs
- DelegateSerializationHolder.cs
- WindowsStatic.cs
- BindingExpressionUncommonField.cs
- DataTableCollection.cs
- DecodeHelper.cs
- ColumnReorderedEventArgs.cs
- EntitySet.cs
- WebPartEventArgs.cs
- LinqDataSourceHelper.cs
- OperatingSystemVersionCheck.cs
- PointAnimationClockResource.cs
- PointAnimationClockResource.cs
- InputEventArgs.cs
- Point.cs
- SqlVisitor.cs
- OracleColumn.cs
- InvokeBase.cs
- ProcessProtocolHandler.cs
- SelectionEditingBehavior.cs
- GlyphingCache.cs
- AnnotationComponentManager.cs
- ListViewTableCell.cs
- SpecialTypeDataContract.cs
- RemotingSurrogateSelector.cs
- RuleSettings.cs
- ArrayListCollectionBase.cs
- ZipIOFileItemStream.cs
- InvalidPropValue.cs
- DodSequenceMerge.cs
- PeerPresenceInfo.cs
- JpegBitmapDecoder.cs
- ThemeInfoAttribute.cs
- NumericPagerField.cs
- FileBasedResourceGroveler.cs
- OpacityConverter.cs
- PackagingUtilities.cs
- CommonRemoteMemoryBlock.cs
- ComplexLine.cs
- Boolean.cs
- SamlAssertionDirectKeyIdentifierClause.cs
- TypeUnloadedException.cs
- Matrix.cs
- DoubleLink.cs
- VectorCollection.cs
- DataBindingExpressionBuilder.cs
- DesignerHost.cs
- MtomMessageEncodingElement.cs
- SerializationAttributes.cs
- ConvertEvent.cs
- FixedPage.cs
- ContentPosition.cs
- ProcessingInstructionAction.cs
- SmtpNtlmAuthenticationModule.cs
- Axis.cs
- HandleInitializationContext.cs
- SessionIDManager.cs
- QueryConverter.cs
- IconEditor.cs
- InternalsVisibleToAttribute.cs
- BufferModeSettings.cs
- Win32Exception.cs
- ResourceDictionaryCollection.cs
- Freezable.cs
- HtmlControl.cs
- IndexerNameAttribute.cs
- ReflectionPermission.cs
- VSWCFServiceContractGenerator.cs
- cookieexception.cs
- initElementDictionary.cs
- ThaiBuddhistCalendar.cs
- TypedDataSetSchemaImporterExtension.cs
- ClickablePoint.cs
- AgileSafeNativeMemoryHandle.cs
- RoleGroup.cs
- EDesignUtil.cs
- CompModSwitches.cs
- DataGridTable.cs
- Utils.cs
- ControlValuePropertyAttribute.cs
- MasterPage.cs
- SQLInt64.cs
- COM2PropertyDescriptor.cs
- Stylesheet.cs
- SiteMembershipCondition.cs
- TrackingValidationObjectDictionary.cs
- UidPropertyAttribute.cs
- EntityProviderFactory.cs
- CodeBinaryOperatorExpression.cs
- StrongNameMembershipCondition.cs
- DispatchWrapper.cs
- XsltInput.cs