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
- Funcletizer.cs
- _ShellExpression.cs
- GifBitmapDecoder.cs
- CallSiteHelpers.cs
- BindingValueChangedEventArgs.cs
- BuildResultCache.cs
- sitestring.cs
- ProfileService.cs
- SizeConverter.cs
- ColumnHeaderCollectionEditor.cs
- ConsoleKeyInfo.cs
- safesecurityhelperavalon.cs
- RadioButtonBaseAdapter.cs
- BitStack.cs
- WrapPanel.cs
- TrackingQueryElement.cs
- ComplexLine.cs
- ArgumentsParser.cs
- SafeFileHandle.cs
- Invariant.cs
- ToolStripContainerActionList.cs
- ImageAutomationPeer.cs
- ModuleConfigurationInfo.cs
- CommandHelper.cs
- SQLGuid.cs
- _ProxyRegBlob.cs
- CodeGeneratorOptions.cs
- ScriptResourceAttribute.cs
- XmlSchemaIdentityConstraint.cs
- SafePipeHandle.cs
- EnumerableRowCollectionExtensions.cs
- HwndTarget.cs
- DateTimeStorage.cs
- QueryExpr.cs
- TabPanel.cs
- PathData.cs
- XmlNotation.cs
- HtmlHead.cs
- ModelUIElement3D.cs
- MutexSecurity.cs
- KeyGesture.cs
- Registration.cs
- SchemaNamespaceManager.cs
- XmlDocumentType.cs
- NavigationExpr.cs
- ThemeableAttribute.cs
- TemplateColumn.cs
- ListSourceHelper.cs
- ChangeNode.cs
- SeverityFilter.cs
- IteratorDescriptor.cs
- ProcessHostFactoryHelper.cs
- StringFormat.cs
- AuthenticateEventArgs.cs
- AddInProcess.cs
- DataGridViewColumnEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- OleDbPropertySetGuid.cs
- ItemsPresenter.cs
- MessageQueuePermission.cs
- FunctionDefinition.cs
- ToolStripGripRenderEventArgs.cs
- Ray3DHitTestResult.cs
- TypeExtensionConverter.cs
- Tile.cs
- ToggleButtonAutomationPeer.cs
- StrokeNodeData.cs
- ToolStripDesignerAvailabilityAttribute.cs
- SizeLimitedCache.cs
- XmlTextWriter.cs
- DateTimeStorage.cs
- GiveFeedbackEvent.cs
- XamlToRtfWriter.cs
- UrlPropertyAttribute.cs
- EdmToObjectNamespaceMap.cs
- LogSwitch.cs
- DES.cs
- TextTreeUndoUnit.cs
- Column.cs
- TimersDescriptionAttribute.cs
- SelectionRangeConverter.cs
- MissingMethodException.cs
- Popup.cs
- CodeCommentStatement.cs
- ObjectKeyFrameCollection.cs
- SchemaSetCompiler.cs
- OracleException.cs
- ReadOnlyNameValueCollection.cs
- WeakReferenceList.cs
- MergablePropertyAttribute.cs
- ZipIOExtraFieldElement.cs
- Touch.cs
- RequestNavigateEventArgs.cs
- DocumentGridContextMenu.cs
- NeutralResourcesLanguageAttribute.cs
- TripleDES.cs
- RoutedEventConverter.cs
- xmlfixedPageInfo.cs
- WindowsComboBox.cs
- DbProviderFactory.cs