Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ErrorsHelper.cs / 1305376 / ErrorsHelper.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System.Collections; using System.Collections.Specialized; using System.Collections.Generic; static internal class ErrorsHelper { static internal int GetErrorCount(Listerrors) { return (errors != null) ? errors.Count : 0; } static internal bool GetHasErrors(List errors) { return GetErrorCount(errors) > 0; } static internal void AddError(ref List errors, ConfigurationException e) { Debug.Assert(e != null, "e != null"); // Create on demand if (errors == null) { errors = new List (); } ConfigurationErrorsException ce = e as ConfigurationErrorsException; if (ce == null) { errors.Add(e); } else { ICollection col = ce.ErrorsGeneric; if (col.Count == 1) { errors.Add(e); } else { errors.AddRange(col); } } } static internal void AddErrors(ref List errors, ICollection coll) { if (coll == null || coll.Count == 0) { // Nothing to do here, bail return; } foreach (ConfigurationException e in coll) { AddError(ref errors, e); } } static internal ConfigurationErrorsException GetErrorsException(List errors) { if (errors == null) { return null; } Debug.Assert(errors.Count != 0, "errors.Count != 0"); return new ConfigurationErrorsException(errors); } static internal void ThrowOnErrors(List errors) { ConfigurationErrorsException e = GetErrorsException(errors); if (e != null) { throw e; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Configuration { using System.Collections; using System.Collections.Specialized; using System.Collections.Generic; static internal class ErrorsHelper { static internal int GetErrorCount(Listerrors) { return (errors != null) ? errors.Count : 0; } static internal bool GetHasErrors(List errors) { return GetErrorCount(errors) > 0; } static internal void AddError(ref List errors, ConfigurationException e) { Debug.Assert(e != null, "e != null"); // Create on demand if (errors == null) { errors = new List (); } ConfigurationErrorsException ce = e as ConfigurationErrorsException; if (ce == null) { errors.Add(e); } else { ICollection col = ce.ErrorsGeneric; if (col.Count == 1) { errors.Add(e); } else { errors.AddRange(col); } } } static internal void AddErrors(ref List errors, ICollection coll) { if (coll == null || coll.Count == 0) { // Nothing to do here, bail return; } foreach (ConfigurationException e in coll) { AddError(ref errors, e); } } static internal ConfigurationErrorsException GetErrorsException(List errors) { if (errors == null) { return null; } Debug.Assert(errors.Count != 0, "errors.Count != 0"); return new ConfigurationErrorsException(errors); } static internal void ThrowOnErrors(List errors) { ConfigurationErrorsException e = GetErrorsException(errors); if (e != null) { throw e; } } } } // 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
- XmlSubtreeReader.cs
- UpDownBase.cs
- _ListenerRequestStream.cs
- IgnoreSectionHandler.cs
- TextComposition.cs
- UriTemplatePathSegment.cs
- Double.cs
- CollectionConverter.cs
- ProgressBarHighlightConverter.cs
- XmlSubtreeReader.cs
- SqlDataSourceFilteringEventArgs.cs
- StorageMappingItemLoader.cs
- DesignBindingValueUIHandler.cs
- XPathDocumentNavigator.cs
- TouchFrameEventArgs.cs
- HttpListenerContext.cs
- MouseBinding.cs
- Span.cs
- IdleTimeoutMonitor.cs
- ScriptReferenceBase.cs
- PropertyInformationCollection.cs
- XomlCompiler.cs
- SymDocumentType.cs
- BindingMAnagerBase.cs
- EntityWrapperFactory.cs
- XmlUtil.cs
- ScriptControlDescriptor.cs
- CmsInterop.cs
- PropertyManager.cs
- PolyQuadraticBezierSegment.cs
- SafeRegistryHandle.cs
- EmptyEnumerator.cs
- RectangleConverter.cs
- AsyncOperationContext.cs
- XPathParser.cs
- HtmlElementErrorEventArgs.cs
- SiteMapPath.cs
- EditorPart.cs
- QueryStringParameter.cs
- CustomAttributeSerializer.cs
- Separator.cs
- assemblycache.cs
- TreeViewImageKeyConverter.cs
- MethodAccessException.cs
- OdbcEnvironmentHandle.cs
- ClassicBorderDecorator.cs
- WebContext.cs
- WsatConfiguration.cs
- AttachmentService.cs
- DataGridViewControlCollection.cs
- ServiceNameElement.cs
- InputScopeConverter.cs
- OdbcException.cs
- ChildDocumentBlock.cs
- SynchronizingStream.cs
- WhereQueryOperator.cs
- XmlSchemaInferenceException.cs
- RepeaterItemEventArgs.cs
- HashCodeCombiner.cs
- NamespaceCollection.cs
- CapabilitiesSection.cs
- EntryPointNotFoundException.cs
- ForeignConstraint.cs
- DataTableCollection.cs
- TypeLibConverter.cs
- ListManagerBindingsCollection.cs
- Double.cs
- SingleStorage.cs
- RepeaterItemEventArgs.cs
- safesecurityhelperavalon.cs
- OleServicesContext.cs
- AssemblyResourceLoader.cs
- NegotiationTokenAuthenticatorState.cs
- HiddenFieldPageStatePersister.cs
- ListViewItem.cs
- GridViewRowCollection.cs
- ProtocolsConfigurationEntry.cs
- OdbcCommandBuilder.cs
- ClosureBinding.cs
- DataGridTable.cs
- ControlOperationInvoker.cs
- RelationshipFixer.cs
- LinearKeyFrames.cs
- UInt32.cs
- SystemIPAddressInformation.cs
- ComponentResourceKeyConverter.cs
- ValidatorUtils.cs
- FileAuthorizationModule.cs
- DataAdapter.cs
- SettingsProviderCollection.cs
- DeclarativeCatalogPart.cs
- SchemaContext.cs
- UnauthorizedWebPart.cs
- ExtensionDataReader.cs
- DataGridViewTopRowAccessibleObject.cs
- XmlValidatingReaderImpl.cs
- TreeViewEvent.cs
- ImageSourceConverter.cs
- EditorPartChrome.cs
- Point3DCollectionConverter.cs