Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SerializationAttributes.cs
- ContourSegment.cs
- SchemaImporterExtensionElement.cs
- X509Certificate2Collection.cs
- HttpRawResponse.cs
- OrderedParallelQuery.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- IncrementalHitTester.cs
- InvalidProgramException.cs
- ObjectPersistData.cs
- UnsafeMethods.cs
- ServicesUtilities.cs
- TemplateKey.cs
- HttpWebRequestElement.cs
- Invariant.cs
- LayoutEngine.cs
- ProfileSettings.cs
- FormsIdentity.cs
- RectangleConverter.cs
- JpegBitmapDecoder.cs
- MimePart.cs
- Encoding.cs
- DataGridViewControlCollection.cs
- ElementFactory.cs
- CodeExporter.cs
- PtsHost.cs
- CharEntityEncoderFallback.cs
- LinqExpressionNormalizer.cs
- ThaiBuddhistCalendar.cs
- SSmlParser.cs
- BitmapSourceSafeMILHandle.cs
- ConfigurationSectionCollection.cs
- StringReader.cs
- InitializationEventAttribute.cs
- AsymmetricAlgorithm.cs
- SynchronizedDispatch.cs
- FontCacheUtil.cs
- PropertyMapper.cs
- AudioDeviceOut.cs
- ViewCellRelation.cs
- FilterableAttribute.cs
- CriticalFinalizerObject.cs
- OleCmdHelper.cs
- BitmapPalette.cs
- Separator.cs
- AutoGeneratedFieldProperties.cs
- InteropExecutor.cs
- WebPartManagerInternals.cs
- XmlSerializationGeneratedCode.cs
- FactoryGenerator.cs
- BrowserCapabilitiesFactory.cs
- webeventbuffer.cs
- BufferedConnection.cs
- EndpointAddressProcessor.cs
- TextRangeAdaptor.cs
- Rectangle.cs
- FloatUtil.cs
- SelectionEditingBehavior.cs
- CookielessHelper.cs
- PriorityRange.cs
- Validator.cs
- OrthographicCamera.cs
- RangeValidator.cs
- SerializationObjectManager.cs
- OdbcException.cs
- CompilationRelaxations.cs
- Parameter.cs
- TaskFormBase.cs
- PathSegmentCollection.cs
- FlagsAttribute.cs
- DesignerCategoryAttribute.cs
- FormViewModeEventArgs.cs
- ImpersonationContext.cs
- AddInActivator.cs
- EventProxy.cs
- XmlTypeMapping.cs
- sitestring.cs
- CustomErrorsSection.cs
- GlobalEventManager.cs
- WebResourceAttribute.cs
- XmlSchemaDocumentation.cs
- GenericRootAutomationPeer.cs
- UnmanagedMarshal.cs
- FileClassifier.cs
- TimeoutStream.cs
- COM2ComponentEditor.cs
- MD5.cs
- RoutedEventArgs.cs
- CharAnimationBase.cs
- HierarchicalDataBoundControlAdapter.cs
- DodSequenceMerge.cs
- ContentIterators.cs
- MetadataArtifactLoader.cs
- ToolboxItemLoader.cs
- XmlSchemaAppInfo.cs
- ObjectQuery_EntitySqlExtensions.cs
- CodeExpressionCollection.cs
- ManualResetEvent.cs
- CodeGenerator.cs
- BufferAllocator.cs