Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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();; } */ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // 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();; } */ } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StrokeCollection2.cs
- ExpandedWrapper.cs
- DetailsViewInsertEventArgs.cs
- ListBoxItemWrapperAutomationPeer.cs
- Binding.cs
- StatusBarAutomationPeer.cs
- DSASignatureFormatter.cs
- ChameleonKey.cs
- ConfigurationValidatorBase.cs
- CurrentChangingEventManager.cs
- PropertyInformation.cs
- PathFigureCollection.cs
- PeerObject.cs
- TaiwanLunisolarCalendar.cs
- DriveInfo.cs
- AssemblyBuilder.cs
- DPTypeDescriptorContext.cs
- WorkflowApplicationException.cs
- TypeDelegator.cs
- ComNativeDescriptor.cs
- X509ServiceCertificateAuthentication.cs
- StrokeNodeEnumerator.cs
- InstanceDataCollectionCollection.cs
- SelectiveScrollingGrid.cs
- WebPart.cs
- ProvidersHelper.cs
- BamlRecords.cs
- DbConnectionPoolCounters.cs
- ButtonBaseAutomationPeer.cs
- ImmutableObjectAttribute.cs
- TextComposition.cs
- CardSpacePolicyElement.cs
- BufferedGraphicsManager.cs
- HttpHandlerActionCollection.cs
- ConnectionPoint.cs
- XmlEncodedRawTextWriter.cs
- PropertyStore.cs
- OdbcFactory.cs
- EventSourceCreationData.cs
- CompiledXpathExpr.cs
- CachingHintValidation.cs
- BrowserDefinitionCollection.cs
- XmlSchemaInclude.cs
- StandardCommands.cs
- GenericIdentity.cs
- PresentationSource.cs
- ToolStripArrowRenderEventArgs.cs
- AnnotationComponentManager.cs
- ModelVisual3D.cs
- IndependentlyAnimatedPropertyMetadata.cs
- XPathNavigatorReader.cs
- DoubleKeyFrameCollection.cs
- TableLayoutRowStyleCollection.cs
- PolicyManager.cs
- RichTextBox.cs
- TextParagraphView.cs
- CmsInterop.cs
- DataGridViewCellCancelEventArgs.cs
- Style.cs
- AppSettingsExpressionBuilder.cs
- Vector3DAnimationBase.cs
- PropertyMapper.cs
- XmlSignatureProperties.cs
- Transform.cs
- HTMLTagNameToTypeMapper.cs
- Light.cs
- IPGlobalProperties.cs
- ServiceBehaviorAttribute.cs
- TypeDescriptionProviderAttribute.cs
- DataControlFieldCell.cs
- ManagementExtension.cs
- MultiPartWriter.cs
- ViewgenGatekeeper.cs
- AssemblyCollection.cs
- FileRecordSequenceCompletedAsyncResult.cs
- XsdSchemaFileEditor.cs
- ComboBoxItem.cs
- ComponentManagerBroker.cs
- MessageDecoder.cs
- HtmlContainerControl.cs
- CounterSetInstance.cs
- PeerChannelListener.cs
- HtmlEmptyTagControlBuilder.cs
- IteratorFilter.cs
- HttpModuleActionCollection.cs
- EncodingNLS.cs
- ValidateNames.cs
- TriggerBase.cs
- Operator.cs
- ToolBar.cs
- CompiledQuery.cs
- Win32PrintDialog.cs
- AuthenticationException.cs
- DeclarationUpdate.cs
- Tuple.cs
- MaterialGroup.cs
- CookieProtection.cs
- ResourceSetExpression.cs
- Selection.cs
- TableProviderWrapper.cs