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
- DbConnectionPool.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- ActiveDesignSurfaceEvent.cs
- ServiceOperationParameter.cs
- CryptoHelper.cs
- MappingMetadataHelper.cs
- GridViewCellAutomationPeer.cs
- StylusOverProperty.cs
- ToolTip.cs
- ReturnValue.cs
- BrowserCapabilitiesCompiler.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- XmlNodeChangedEventArgs.cs
- RawStylusInputCustomDataList.cs
- EntityContainerAssociationSet.cs
- DataFormat.cs
- RSAOAEPKeyExchangeFormatter.cs
- ShapingWorkspace.cs
- Convert.cs
- ColumnWidthChangingEvent.cs
- DropDownList.cs
- InternalSafeNativeMethods.cs
- TextServicesProperty.cs
- CodeEntryPointMethod.cs
- RepeaterItem.cs
- XPathExpr.cs
- EventDescriptorCollection.cs
- XmlTextReader.cs
- CommonGetThemePartSize.cs
- MetadataItemEmitter.cs
- WebPartConnection.cs
- DesignerRegion.cs
- WebPartCloseVerb.cs
- ServiceEndpointCollection.cs
- SqlBuffer.cs
- DataGridViewCellStyleBuilderDialog.cs
- xmlglyphRunInfo.cs
- StreamInfo.cs
- TemplateBindingExtensionConverter.cs
- TextDocumentView.cs
- NativeMethodsOther.cs
- X509AsymmetricSecurityKey.cs
- Material.cs
- LogExtentCollection.cs
- PermissionSetEnumerator.cs
- GridLength.cs
- MsmqQueue.cs
- DashStyle.cs
- Listen.cs
- MergeFilterQuery.cs
- IOException.cs
- WsatConfiguration.cs
- SiteMapPath.cs
- WSDualHttpBinding.cs
- LayoutExceptionEventArgs.cs
- LocatorBase.cs
- WriteStateInfoBase.cs
- AddressingVersion.cs
- QueryContinueDragEvent.cs
- EqualityComparer.cs
- XmlDocument.cs
- ThreadAttributes.cs
- ToolStripRenderEventArgs.cs
- LineServicesRun.cs
- TableLayoutPanelDesigner.cs
- PagesSection.cs
- PolicyImporterElementCollection.cs
- UnsafeNativeMethods.cs
- DirectoryObjectSecurity.cs
- InitializeCorrelation.cs
- InputManager.cs
- CharUnicodeInfo.cs
- EnumConverter.cs
- TakeQueryOptionExpression.cs
- FormViewInsertedEventArgs.cs
- ApplicationManager.cs
- MatrixValueSerializer.cs
- ReadOnlyDataSource.cs
- CustomTokenProvider.cs
- CodeDomDesignerLoader.cs
- SerialPort.cs
- ColumnWidthChangedEvent.cs
- RtfControlWordInfo.cs
- BinaryCommonClasses.cs
- sqlcontext.cs
- SystemIPv6InterfaceProperties.cs
- ExceptionUtil.cs
- UriParserTemplates.cs
- StrokeNode.cs
- StateChangeEvent.cs
- TableLayout.cs
- SizeAnimationBase.cs
- ExpressionHelper.cs
- EndOfStreamException.cs
- NameSpaceEvent.cs
- cookieexception.cs
- XsdSchemaFileEditor.cs
- DetectEofStream.cs
- PropertyDescriptorGridEntry.cs
- PropertyDescriptorCollection.cs