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
- Deserializer.cs
- HtmlTernaryTree.cs
- SynchronousChannelMergeEnumerator.cs
- MailMessage.cs
- ThreadAttributes.cs
- UInt64Converter.cs
- CodeDomSerializationProvider.cs
- RulePatternOps.cs
- SiteMapProvider.cs
- EventDescriptor.cs
- updateconfighost.cs
- PolygonHotSpot.cs
- XMLDiffLoader.cs
- DataServiceQueryOfT.cs
- SystemWebExtensionsSectionGroup.cs
- ToolStripSplitStackLayout.cs
- RawTextInputReport.cs
- Completion.cs
- NGCSerializationManagerAsync.cs
- ObjectContext.cs
- UriSection.cs
- GridViewUpdateEventArgs.cs
- DisableDpiAwarenessAttribute.cs
- CellPartitioner.cs
- EventProviderClassic.cs
- ApplicationTrust.cs
- DataGridViewTextBoxCell.cs
- DropDownList.cs
- DiagnosticSection.cs
- Registry.cs
- storepermissionattribute.cs
- LoginViewDesigner.cs
- ValidationErrorEventArgs.cs
- DataBoundControlDesigner.cs
- InvalidWMPVersionException.cs
- ZoneLinkButton.cs
- DataGridColumnHeader.cs
- ParameterInfo.cs
- BulletChrome.cs
- EnumerableRowCollectionExtensions.cs
- InitializerFacet.cs
- ColumnMapTranslator.cs
- Focus.cs
- CustomSignedXml.cs
- DBBindings.cs
- AspNetSynchronizationContext.cs
- XhtmlBasicPanelAdapter.cs
- TimeoutException.cs
- QuaternionIndependentAnimationStorage.cs
- AttachedAnnotationChangedEventArgs.cs
- JournalEntry.cs
- DescendentsWalkerBase.cs
- TypographyProperties.cs
- BufferedWebEventProvider.cs
- _NegoStream.cs
- PersistChildrenAttribute.cs
- PaintEvent.cs
- ExternalFile.cs
- PathHelper.cs
- SyndicationPerson.cs
- BitmapEffectGeneralTransform.cs
- SQLByte.cs
- PassportAuthenticationModule.cs
- GridPatternIdentifiers.cs
- AppLevelCompilationSectionCache.cs
- ArrayTypeMismatchException.cs
- HyperLinkDataBindingHandler.cs
- GridViewRowCollection.cs
- DataBoundControlHelper.cs
- SelectionPatternIdentifiers.cs
- PathGeometry.cs
- InternalTransaction.cs
- BmpBitmapDecoder.cs
- UserControlBuildProvider.cs
- JsonQNameDataContract.cs
- Rect3D.cs
- DuplicateMessageDetector.cs
- LOSFormatter.cs
- SocketException.cs
- MachineKeyConverter.cs
- TraceContextEventArgs.cs
- PageParserFilter.cs
- EntityViewGenerationConstants.cs
- TouchesOverProperty.cs
- CustomAttributeBuilder.cs
- InstanceNormalEvent.cs
- EmptyElement.cs
- InkCanvasSelectionAdorner.cs
- XhtmlTextWriter.cs
- MILUtilities.cs
- CellParagraph.cs
- OutputCacheProfileCollection.cs
- ExpressionPrefixAttribute.cs
- WindowCollection.cs
- SqlGatherConsumedAliases.cs
- PageContent.cs
- PartBasedPackageProperties.cs
- LogicalTreeHelper.cs
- DefaultClaimSet.cs
- ImpersonationContext.cs