Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Configuration / System / Configuration / ErrorsHelper.cs / 1 / 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
- FormCollection.cs
- BinaryMessageFormatter.cs
- PrinterSettings.cs
- ParseHttpDate.cs
- Pair.cs
- OpCopier.cs
- InvalidCommandTreeException.cs
- ScrollBarRenderer.cs
- Or.cs
- CompilationPass2TaskInternal.cs
- Registry.cs
- httpstaticobjectscollection.cs
- TraceLevelStore.cs
- BooleanProjectedSlot.cs
- Ray3DHitTestResult.cs
- XmlSchemaRedefine.cs
- DragAssistanceManager.cs
- SeverityFilter.cs
- CodeChecksumPragma.cs
- ProfileManager.cs
- TempEnvironment.cs
- safelinkcollection.cs
- SqlDataSourceSelectingEventArgs.cs
- ControlCachePolicy.cs
- RawAppCommandInputReport.cs
- __Error.cs
- Codec.cs
- Contracts.cs
- DeclarationUpdate.cs
- EditorBrowsableAttribute.cs
- CreateParams.cs
- FileDetails.cs
- XamlVector3DCollectionSerializer.cs
- Variant.cs
- ManagedWndProcTracker.cs
- IsolatedStorage.cs
- RandomNumberGenerator.cs
- ExtenderProvidedPropertyAttribute.cs
- SqlCacheDependency.cs
- BaseAutoFormat.cs
- ScrollItemProviderWrapper.cs
- RewritingPass.cs
- ParameterCollection.cs
- Int16AnimationUsingKeyFrames.cs
- HwndSourceParameters.cs
- UpdatePanel.cs
- AutomationFocusChangedEventArgs.cs
- UdpAnnouncementEndpoint.cs
- KnownTypesProvider.cs
- TableLayoutPanelResizeGlyph.cs
- MetabaseServerConfig.cs
- HostingPreferredMapPath.cs
- ResourcePool.cs
- JpegBitmapEncoder.cs
- TextBlockAutomationPeer.cs
- TcpClientCredentialType.cs
- SqlConnectionPoolProviderInfo.cs
- ToggleButtonAutomationPeer.cs
- AnimationTimeline.cs
- SettingsAttributes.cs
- PageCodeDomTreeGenerator.cs
- TdsValueSetter.cs
- X509RecipientCertificateClientElement.cs
- ToolStripItemImageRenderEventArgs.cs
- TemplateNodeContextMenu.cs
- LayoutInformation.cs
- XsltContext.cs
- IntegrationExceptionEventArgs.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- TypedColumnHandler.cs
- FileClassifier.cs
- FormViewUpdateEventArgs.cs
- ProxyAssemblyNotLoadedException.cs
- BypassElementCollection.cs
- SqlTransaction.cs
- System.Data_BID.cs
- XmlQueryStaticData.cs
- GrammarBuilderBase.cs
- Polygon.cs
- UnmanagedMarshal.cs
- StringFormat.cs
- XmlEncodedRawTextWriter.cs
- Mutex.cs
- DPCustomTypeDescriptor.cs
- LoginViewDesigner.cs
- TraceLog.cs
- HttpModulesSection.cs
- CommonEndpointBehaviorElement.cs
- SendKeys.cs
- RawAppCommandInputReport.cs
- DataGridViewLinkCell.cs
- MSAAWinEventWrap.cs
- _HelperAsyncResults.cs
- NotifyInputEventArgs.cs
- DataGridView.cs
- RegexStringValidatorAttribute.cs
- AnonymousIdentificationSection.cs
- ControlAdapter.cs
- AuthenticationModulesSection.cs
- EntityDataSourceDataSelection.cs