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
- ToolStripDropTargetManager.cs
- TemplatedWizardStep.cs
- Helper.cs
- AppDomain.cs
- Timer.cs
- DbConnectionInternal.cs
- HttpTransportBindingElement.cs
- SHA384Managed.cs
- Baml2006ReaderSettings.cs
- DecoderBestFitFallback.cs
- DynamicControl.cs
- CountAggregationOperator.cs
- WindowInteractionStateTracker.cs
- KeyValuePairs.cs
- DetailsViewRow.cs
- DataSourceControlBuilder.cs
- ObservableCollection.cs
- ApplicationInfo.cs
- ByteConverter.cs
- XamlWrappingReader.cs
- WebContext.cs
- ContravarianceAdapter.cs
- Clause.cs
- CornerRadius.cs
- CodeTypeReference.cs
- WeakReferenceEnumerator.cs
- ISessionStateStore.cs
- TableCell.cs
- WindowsAltTab.cs
- updateconfighost.cs
- DCSafeHandle.cs
- XmlName.cs
- RtType.cs
- ExpanderAutomationPeer.cs
- TypeUtils.cs
- TextEditorParagraphs.cs
- WeakReadOnlyCollection.cs
- HttpContextServiceHost.cs
- Model3DGroup.cs
- TemplateInstanceAttribute.cs
- HandlerWithFactory.cs
- Compiler.cs
- OleDbFactory.cs
- SkewTransform.cs
- TextEndOfSegment.cs
- CqlLexerHelpers.cs
- PersonalizationProviderHelper.cs
- Knowncolors.cs
- CharEnumerator.cs
- VisualProxy.cs
- CryptoConfig.cs
- SiteOfOriginContainer.cs
- DetailsViewDeletedEventArgs.cs
- FlowLayout.cs
- ErrorTableItemStyle.cs
- DrawingContextDrawingContextWalker.cs
- BaseAsyncResult.cs
- DocumentViewerBase.cs
- MultiAsyncResult.cs
- ObjectManager.cs
- BindingSource.cs
- ValueUnavailableException.cs
- TableColumn.cs
- CredentialCache.cs
- dtdvalidator.cs
- ExpressionBindingCollection.cs
- RepeaterItemCollection.cs
- RequestBringIntoViewEventArgs.cs
- ColorKeyFrameCollection.cs
- METAHEADER.cs
- DomainConstraint.cs
- OleDragDropHandler.cs
- Win32PrintDialog.cs
- DoubleIndependentAnimationStorage.cs
- DiscoveryDocumentSerializer.cs
- NumericUpDownAccelerationCollection.cs
- AuthenticationManager.cs
- DiscoveryMessageSequenceGenerator.cs
- DefinitionBase.cs
- TextBox.cs
- TextServicesHost.cs
- ActivationServices.cs
- SqlDataRecord.cs
- EmissiveMaterial.cs
- DependencyPropertyKind.cs
- ModelItemDictionaryImpl.cs
- InternalsVisibleToAttribute.cs
- SQLMoneyStorage.cs
- Run.cs
- FileRecordSequenceHelper.cs
- XNodeValidator.cs
- ToolStripButton.cs
- TripleDESCryptoServiceProvider.cs
- SelectionProcessor.cs
- PackageStore.cs
- Encoder.cs
- LinkArea.cs
- Rotation3DKeyFrameCollection.cs
- UIElement3D.cs
- MessageSecurityException.cs