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
- isolationinterop.cs
- PrintPageEvent.cs
- SafeBitVector32.cs
- OleStrCAMarshaler.cs
- EdmType.cs
- TextEmbeddedObject.cs
- CellTreeNodeVisitors.cs
- RelatedCurrencyManager.cs
- Canvas.cs
- WebBrowserHelper.cs
- FontFamily.cs
- Util.cs
- CodeCatchClause.cs
- DataGridViewColumnConverter.cs
- TextReader.cs
- DBCommandBuilder.cs
- EditableTreeList.cs
- InvokeMethodActivity.cs
- XPathBuilder.cs
- GlyphsSerializer.cs
- ProjectionNode.cs
- BinHexDecoder.cs
- ConnectionManagementElementCollection.cs
- EntityException.cs
- ContentElementAutomationPeer.cs
- RepeatBehavior.cs
- FlowSwitchDesigner.xaml.cs
- StructuredTypeEmitter.cs
- ToolboxComponentsCreatingEventArgs.cs
- WCFModelStrings.Designer.cs
- Win32.cs
- SplashScreen.cs
- EdgeModeValidation.cs
- BitArray.cs
- documentsequencetextpointer.cs
- FixedPosition.cs
- ParameterCollectionEditorForm.cs
- SoapEnumAttribute.cs
- ExceptionUtil.cs
- CatalogPartCollection.cs
- UncommonField.cs
- XmlSchemaIdentityConstraint.cs
- FieldNameLookup.cs
- DataControlFieldCell.cs
- CodeMethodReturnStatement.cs
- UInt64.cs
- PackUriHelper.cs
- CompilerGlobalScopeAttribute.cs
- BulletChrome.cs
- HostedController.cs
- DrawingCollection.cs
- DbMetaDataColumnNames.cs
- MarkupCompilePass1.cs
- AutoGeneratedFieldProperties.cs
- TimeSpanMinutesConverter.cs
- MembershipUser.cs
- ExpressionEditor.cs
- Variant.cs
- ClientSettingsSection.cs
- PlanCompilerUtil.cs
- IndexedSelectQueryOperator.cs
- InternalControlCollection.cs
- XsltOutput.cs
- ParameterElementCollection.cs
- PartManifestEntry.cs
- TrackingProfileDeserializationException.cs
- GeneralTransform.cs
- ValueProviderWrapper.cs
- ListDictionaryInternal.cs
- MsmqBindingElementBase.cs
- TransformGroup.cs
- WindowsListViewScroll.cs
- RuleSetBrowserDialog.cs
- ReferenceConverter.cs
- PropertySet.cs
- XamlTypeMapper.cs
- CompilationSection.cs
- DataGridViewTopRowAccessibleObject.cs
- CodeVariableReferenceExpression.cs
- DataStreamFromComStream.cs
- Adorner.cs
- PageCatalogPart.cs
- MemoryRecordBuffer.cs
- XamlTypeMapper.cs
- EventLog.cs
- QuaternionRotation3D.cs
- SourceChangedEventArgs.cs
- BinaryObjectWriter.cs
- EditorPartCollection.cs
- WindowsFormsHostAutomationPeer.cs
- AttributeExtensions.cs
- MouseButton.cs
- LineGeometry.cs
- OutputWindow.cs
- ExpressionConverter.cs
- SingleAnimationUsingKeyFrames.cs
- DataKeyCollection.cs
- XpsFilter.cs
- BitmapEffectInput.cs
- ManagedWndProcTracker.cs