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
- EdmItemError.cs
- TemplateXamlParser.cs
- OleDbStruct.cs
- GeneralTransform.cs
- IListConverters.cs
- HijriCalendar.cs
- ServiceRouteHandler.cs
- ObjectStateManager.cs
- DataBoundLiteralControl.cs
- PrinterResolution.cs
- ContentTextAutomationPeer.cs
- BufferedReadStream.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- TTSVoice.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- ThreadStateException.cs
- XmlEntity.cs
- HtmlTextBoxAdapter.cs
- Utils.cs
- RegistryDataKey.cs
- ToolStripOverflow.cs
- DataAdapter.cs
- Operand.cs
- DataGrid.cs
- ResourceManager.cs
- IOException.cs
- XamlToRtfParser.cs
- EmbossBitmapEffect.cs
- X509CertificateRecipientClientCredential.cs
- XmlCodeExporter.cs
- AuthenticationService.cs
- EdmScalarPropertyAttribute.cs
- PageBreakRecord.cs
- DocumentApplicationState.cs
- UnitySerializationHolder.cs
- CfgParser.cs
- SByte.cs
- DynamicDiscoveryDocument.cs
- RemotingAttributes.cs
- CodeEntryPointMethod.cs
- Variant.cs
- RichTextBoxConstants.cs
- PersonalizationProvider.cs
- TrackingQueryElement.cs
- Grammar.cs
- DynamicValueConverter.cs
- InputScopeManager.cs
- FileRegion.cs
- HtmlButton.cs
- Int32.cs
- QilStrConcatenator.cs
- MetadataCache.cs
- DataServiceProcessingPipeline.cs
- DataViewSettingCollection.cs
- ChannelAcceptor.cs
- DbModificationCommandTree.cs
- SiteMapNodeItemEventArgs.cs
- ModuleElement.cs
- PathHelper.cs
- MatrixAnimationBase.cs
- PropertyMetadata.cs
- FieldTemplateFactory.cs
- MiniAssembly.cs
- OracleParameterCollection.cs
- ValidationPropertyAttribute.cs
- ModelPropertyImpl.cs
- FirewallWrapper.cs
- OracleBinary.cs
- Int64.cs
- _AutoWebProxyScriptEngine.cs
- PartialTrustVisibleAssemblyCollection.cs
- ExtentKey.cs
- XmlSchemaSet.cs
- WebScriptEnablingBehavior.cs
- ScriptBehaviorDescriptor.cs
- CategoriesDocumentFormatter.cs
- PropertyValueChangedEvent.cs
- XmlDigitalSignatureProcessor.cs
- CommentAction.cs
- SystemIcons.cs
- CachedPathData.cs
- AmbientValueAttribute.cs
- AppliedDeviceFiltersDialog.cs
- MetadataHelper.cs
- processwaithandle.cs
- DbParameterHelper.cs
- HwndMouseInputProvider.cs
- ViewStateModeByIdAttribute.cs
- DPTypeDescriptorContext.cs
- MulticastNotSupportedException.cs
- ShaperBuffers.cs
- MouseGesture.cs
- Privilege.cs
- Gdiplus.cs
- ExtensionQuery.cs
- SoundPlayerAction.cs
- ThicknessAnimation.cs
- TemplateBindingExpressionConverter.cs
- DeferredReference.cs
- ScrollProviderWrapper.cs