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
- TextServicesLoader.cs
- AutomationIdentifier.cs
- MD5CryptoServiceProvider.cs
- HotSpotCollection.cs
- TileBrush.cs
- EllipticalNodeOperations.cs
- DataBoundControlHelper.cs
- Policy.cs
- TextEditorParagraphs.cs
- DetailsViewModeEventArgs.cs
- DataGridRow.cs
- Triplet.cs
- XmlSchemaType.cs
- X509ThumbprintKeyIdentifierClause.cs
- CommonRemoteMemoryBlock.cs
- ProtocolViolationException.cs
- WindowsAltTab.cs
- XmlConvert.cs
- WebDescriptionAttribute.cs
- OneWayChannelFactory.cs
- ToolStripItemImageRenderEventArgs.cs
- CryptoStream.cs
- WebPartZoneBase.cs
- BooleanFunctions.cs
- MembershipPasswordException.cs
- MatrixIndependentAnimationStorage.cs
- ColumnResizeUndoUnit.cs
- OleDbStruct.cs
- AddInPipelineAttributes.cs
- TreeViewHitTestInfo.cs
- Mapping.cs
- odbcmetadatacolumnnames.cs
- Polyline.cs
- CellCreator.cs
- CornerRadius.cs
- XmlArrayAttribute.cs
- SHA512Managed.cs
- DataMember.cs
- WebConfigurationHost.cs
- FontFamily.cs
- FontNamesConverter.cs
- WindowPattern.cs
- ConditionCollection.cs
- InkCanvasAutomationPeer.cs
- PageBuildProvider.cs
- DrawingGroup.cs
- CannotUnloadAppDomainException.cs
- IndexedGlyphRun.cs
- XPathAncestorIterator.cs
- SqlRemoveConstantOrderBy.cs
- COM2ColorConverter.cs
- SerialStream.cs
- SoapAttributeOverrides.cs
- HtmlTableRow.cs
- TreeViewCancelEvent.cs
- PipelineModuleStepContainer.cs
- ZipIOExtraFieldPaddingElement.cs
- WebPartConnectionsConnectVerb.cs
- StorageBasedPackageProperties.cs
- DialogResultConverter.cs
- _FixedSizeReader.cs
- SafeMILHandle.cs
- XmlAnyElementAttributes.cs
- ToggleButton.cs
- Material.cs
- CreateSequenceResponse.cs
- MenuItem.cs
- HttpProfileGroupBase.cs
- GeneratedView.cs
- ConvertEvent.cs
- ConcurrencyBehavior.cs
- WindowsTooltip.cs
- DefaultPropertyAttribute.cs
- BindingUtils.cs
- PathGeometry.cs
- Vector.cs
- MetadataSet.cs
- XPathNodeList.cs
- ConfigXmlAttribute.cs
- AmbientLight.cs
- Behavior.cs
- KeyConverter.cs
- EntityDataSourceValidationException.cs
- BuildResult.cs
- RPIdentityRequirement.cs
- UIElement3D.cs
- Variant.cs
- CommandID.cs
- SystemUdpStatistics.cs
- EntityKey.cs
- FontCacheUtil.cs
- NumberFunctions.cs
- ReflectEventDescriptor.cs
- HttpCachePolicyElement.cs
- CustomAttribute.cs
- RequestNavigateEventArgs.cs
- DesignerSerializationVisibilityAttribute.cs
- TabPanel.cs
- DrawItemEvent.cs
- Message.cs