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
- StringUtil.cs
- GridViewUpdatedEventArgs.cs
- EdmMember.cs
- XmlNamespaceMappingCollection.cs
- MethodBuilder.cs
- InfoCardServiceInstallComponent.cs
- DeadCharTextComposition.cs
- LineSegment.cs
- DCSafeHandle.cs
- StyleCollection.cs
- AttributeEmitter.cs
- COSERVERINFO.cs
- WindowsGraphicsWrapper.cs
- SoapSchemaMember.cs
- DiscoveryDocumentSearchPattern.cs
- PreviewControlDesigner.cs
- DeclaredTypeValidator.cs
- DataGridRowHeader.cs
- FileUtil.cs
- DataControlButton.cs
- QuaternionRotation3D.cs
- Vector3DCollectionConverter.cs
- PeerPresenceInfo.cs
- newinstructionaction.cs
- SqlUdtInfo.cs
- DelegateHelpers.cs
- HitTestParameters.cs
- PersistChildrenAttribute.cs
- OperationAbortedException.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- MessageLoggingElement.cs
- ApplicationBuildProvider.cs
- WindowsListViewSubItem.cs
- SymmetricAlgorithm.cs
- CompositeControlDesigner.cs
- Buffer.cs
- EncodingInfo.cs
- HashHelpers.cs
- ComProxy.cs
- Style.cs
- base64Transforms.cs
- PolicyException.cs
- KeyGestureValueSerializer.cs
- _StreamFramer.cs
- FrameworkObject.cs
- XmlBaseReader.cs
- EventSinkHelperWriter.cs
- SystemDropShadowChrome.cs
- TemplateXamlParser.cs
- WpfKnownTypeInvoker.cs
- ClickablePoint.cs
- ResourceExpressionBuilder.cs
- IntegerValidatorAttribute.cs
- ComponentDispatcherThread.cs
- CryptoApi.cs
- RandomNumberGenerator.cs
- ListViewTableCell.cs
- TaskFileService.cs
- MarkupCompiler.cs
- SoapAttributeOverrides.cs
- ClassicBorderDecorator.cs
- WrappedOptions.cs
- EntityDesignerUtils.cs
- SynchronizationLockException.cs
- TemplateManager.cs
- EmptyElement.cs
- SystemEvents.cs
- Viewport2DVisual3D.cs
- RemotingServices.cs
- Point3DCollection.cs
- ApplicationId.cs
- IgnoreFileBuildProvider.cs
- LinearQuaternionKeyFrame.cs
- TrustManagerMoreInformation.cs
- CaseExpr.cs
- ObjectItemConventionAssemblyLoader.cs
- ConfigXmlElement.cs
- OleDbMetaDataFactory.cs
- TextFragmentEngine.cs
- QilReference.cs
- Panel.cs
- EntitySetBaseCollection.cs
- OleDbConnectionInternal.cs
- CodeAttributeArgument.cs
- WindowsGraphicsCacheManager.cs
- WebPartConnection.cs
- Calendar.cs
- TransformGroup.cs
- Item.cs
- MessageHeaderDescription.cs
- AssociatedControlConverter.cs
- SmtpDateTime.cs
- DocumentApplicationJournalEntry.cs
- ClassImporter.cs
- BasicAsyncResult.cs
- ComplusTypeValidator.cs
- SafeFileHandle.cs
- CommandExpr.cs
- ConfigXmlComment.cs
- CommandConverter.cs