Code:
/ DotNET / DotNET / 8.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
- DataGridRowClipboardEventArgs.cs
- BrowsableAttribute.cs
- AnnotationAuthorChangedEventArgs.cs
- ScrollEvent.cs
- ImageListStreamer.cs
- NavigationProperty.cs
- SupportingTokenBindingElement.cs
- MasterPage.cs
- EventHandlersStore.cs
- HyperlinkAutomationPeer.cs
- BoundPropertyEntry.cs
- Privilege.cs
- GradientBrush.cs
- MDIControlStrip.cs
- BufferBuilder.cs
- TextPointerBase.cs
- RequestCachingSection.cs
- HtmlInputControl.cs
- PixelFormats.cs
- WpfPayload.cs
- Brushes.cs
- WpfWebRequestHelper.cs
- ByteAnimationBase.cs
- ScaleTransform.cs
- ColumnHeader.cs
- DynamicQueryableWrapper.cs
- SqlCacheDependencyDatabase.cs
- RemoteWebConfigurationHost.cs
- MultitargetingHelpers.cs
- RewritingProcessor.cs
- SettingsAttributeDictionary.cs
- VSWCFServiceContractGenerator.cs
- IntSecurity.cs
- EmptyControlCollection.cs
- DocumentViewerAutomationPeer.cs
- Timer.cs
- CachedBitmap.cs
- WebSysDescriptionAttribute.cs
- WmpBitmapEncoder.cs
- IxmlLineInfo.cs
- StrokeNodeOperations.cs
- IntegrationExceptionEventArgs.cs
- Enum.cs
- ErrorInfoXmlDocument.cs
- DecoderBestFitFallback.cs
- IsolatedStoragePermission.cs
- RegexParser.cs
- WebSysDefaultValueAttribute.cs
- _NetworkingPerfCounters.cs
- StickyNoteContentControl.cs
- Overlapped.cs
- MeasureData.cs
- DesignObjectWrapper.cs
- ProcessingInstructionAction.cs
- CharUnicodeInfo.cs
- MetadataConversionError.cs
- _SSPIWrapper.cs
- DiscreteKeyFrames.cs
- HttpListener.cs
- FactoryGenerator.cs
- EditBehavior.cs
- ContractMethodParameterInfo.cs
- _SSPIWrapper.cs
- PngBitmapEncoder.cs
- MethodBody.cs
- PseudoWebRequest.cs
- DataGridRelationshipRow.cs
- RowVisual.cs
- SR.cs
- MatcherBuilder.cs
- _OSSOCK.cs
- DataObjectMethodAttribute.cs
- MissingMethodException.cs
- RegisteredExpandoAttribute.cs
- UserInitiatedNavigationPermission.cs
- RoleService.cs
- XPathNodePointer.cs
- PropertyValueUIItem.cs
- BooleanExpr.cs
- BitmapPalettes.cs
- SecurityTimestamp.cs
- HostProtectionPermission.cs
- SmtpCommands.cs
- OpCellTreeNode.cs
- DesignerActionHeaderItem.cs
- CustomWebEventKey.cs
- X500Name.cs
- SmtpReplyReader.cs
- DocumentSchemaValidator.cs
- ParserExtension.cs
- PeerDuplexChannelListener.cs
- QilSortKey.cs
- CompositionDesigner.cs
- CompiledQuery.cs
- Track.cs
- ProfilePropertyMetadata.cs
- ViewgenGatekeeper.cs
- CryptoHelper.cs
- rsa.cs
- WindowsSecurityToken.cs