Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- EditingMode.cs
- HostExecutionContextManager.cs
- RSAProtectedConfigurationProvider.cs
- TypeDescriptor.cs
- PropertyGridEditorPart.cs
- ListItem.cs
- ArrayExtension.cs
- UserControlCodeDomTreeGenerator.cs
- VectorCollectionConverter.cs
- DependencyPropertyChangedEventArgs.cs
- LinqToSqlWrapper.cs
- MaskedTextBox.cs
- AutomationAttributeInfo.cs
- ValidatorCollection.cs
- ActivityTypeResolver.xaml.cs
- DoubleLinkList.cs
- HtmlFormWrapper.cs
- WindowPattern.cs
- UnsafeNativeMethodsTablet.cs
- PresentationSource.cs
- CroppedBitmap.cs
- Simplifier.cs
- SequenceQuery.cs
- SamlAuthorizationDecisionClaimResource.cs
- CompositeDispatchFormatter.cs
- RegexInterpreter.cs
- FirstMatchCodeGroup.cs
- SystemBrushes.cs
- ResourceType.cs
- ListView.cs
- Converter.cs
- StandardBindingImporter.cs
- Metadata.cs
- CompModSwitches.cs
- UnionExpr.cs
- CacheVirtualItemsEvent.cs
- RepeaterCommandEventArgs.cs
- OdbcConnectionOpen.cs
- InkCanvasSelection.cs
- MoveSizeWinEventHandler.cs
- Color.cs
- KeyedHashAlgorithm.cs
- UInt32Converter.cs
- DataRecord.cs
- Content.cs
- ToolStripItemCollection.cs
- Scanner.cs
- CompoundFileStreamReference.cs
- VScrollProperties.cs
- CheckBoxStandardAdapter.cs
- ChangePassword.cs
- WasEndpointConfigContainer.cs
- DataTemplateKey.cs
- HttpConfigurationContext.cs
- RichTextBoxConstants.cs
- UserControl.cs
- ComponentCollection.cs
- UnknownBitmapEncoder.cs
- ObjectDataSourceFilteringEventArgs.cs
- ActiveDocumentEvent.cs
- PagesSection.cs
- VisualBrush.cs
- MetadataArtifactLoaderCompositeFile.cs
- SHA384.cs
- FileResponseElement.cs
- QueryCacheManager.cs
- FixedSOMContainer.cs
- GeometryCombineModeValidation.cs
- AbsoluteQuery.cs
- PbrsForward.cs
- FileSystemWatcher.cs
- ApplyImportsAction.cs
- MbpInfo.cs
- Axis.cs
- MemoryFailPoint.cs
- MatrixTransform.cs
- BlurBitmapEffect.cs
- ConfigurationPropertyCollection.cs
- EntityDataSourceViewSchema.cs
- ImageAnimator.cs
- RecipientInfo.cs
- CheckBoxFlatAdapter.cs
- ipaddressinformationcollection.cs
- DataGridViewLinkCell.cs
- TripleDESCryptoServiceProvider.cs
- Vector3DKeyFrameCollection.cs
- PersonalizableTypeEntry.cs
- DescendentsWalkerBase.cs
- LexicalChunk.cs
- WriteTimeStream.cs
- BitmapEffectInput.cs
- OverflowException.cs
- SecuritySessionSecurityTokenProvider.cs
- DiscoveryService.cs
- RewritingValidator.cs
- FontNamesConverter.cs
- ComponentEditorForm.cs
- DependencyPropertyKind.cs
- StreamGeometryContext.cs
- InfiniteTimeSpanConverter.cs