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
- ObfuscateAssemblyAttribute.cs
- ThreadStateException.cs
- DiscreteKeyFrames.cs
- Animatable.cs
- NamespaceMapping.cs
- GenericTypeParameterConverter.cs
- CmsUtils.cs
- BooleanAnimationUsingKeyFrames.cs
- SwitchAttribute.cs
- DragSelectionMessageFilter.cs
- ClientSettingsProvider.cs
- CfgSemanticTag.cs
- ExternalException.cs
- SemanticKeyElement.cs
- ServiceDescriptionReflector.cs
- WorkflowQueuingService.cs
- PrintDialog.cs
- ErrorActivity.cs
- SerializableAttribute.cs
- SessionPageStateSection.cs
- ComponentGlyph.cs
- MsmqMessageProperty.cs
- EnvironmentPermission.cs
- TextLineResult.cs
- BitmapFrameEncode.cs
- BuildProvidersCompiler.cs
- DateTimeHelper.cs
- APCustomTypeDescriptor.cs
- QuerySafeNavigator.cs
- NullableLongSumAggregationOperator.cs
- UrlMappingsModule.cs
- AppModelKnownContentFactory.cs
- WebResponse.cs
- StreamGeometry.cs
- ConsoleCancelEventArgs.cs
- CopyAttributesAction.cs
- VectorAnimationUsingKeyFrames.cs
- StretchValidation.cs
- ConnectionConsumerAttribute.cs
- HandleCollector.cs
- RegexCapture.cs
- OracleBFile.cs
- StoryFragments.cs
- X509WindowsSecurityToken.cs
- HostVisual.cs
- DataConnectionHelper.cs
- LogWriteRestartAreaState.cs
- GlyphRunDrawing.cs
- arclist.cs
- HttpResponseHeader.cs
- Delegate.cs
- RequestTimeoutManager.cs
- TreeViewImageKeyConverter.cs
- SQLInt64Storage.cs
- _ProxyChain.cs
- ApplyHostConfigurationBehavior.cs
- SiteMapSection.cs
- ToolStripSeparatorRenderEventArgs.cs
- IEnumerable.cs
- BitmapEffectGroup.cs
- SizeChangedInfo.cs
- SystemParameters.cs
- MemberDomainMap.cs
- ScriptResourceInfo.cs
- CompositeActivityMarkupSerializer.cs
- DataSourceNameHandler.cs
- MorphHelper.cs
- CompleteWizardStep.cs
- RuleInfoComparer.cs
- SoapSchemaImporter.cs
- AsymmetricSignatureFormatter.cs
- Brush.cs
- Point.cs
- MethodCallConverter.cs
- CalendarTable.cs
- ButtonChrome.cs
- WizardPanel.cs
- CompilerLocalReference.cs
- IIS7UserPrincipal.cs
- ProtocolsConfigurationHandler.cs
- ExpandedWrapper.cs
- OleDbInfoMessageEvent.cs
- NetTcpBindingElement.cs
- Int64Converter.cs
- CollectionConverter.cs
- DynamicDocumentPaginator.cs
- TypeSystemProvider.cs
- Cell.cs
- GraphicsContext.cs
- XmlBinaryReaderSession.cs
- RelatedPropertyManager.cs
- BaseTemplateBuildProvider.cs
- HandlerFactoryCache.cs
- EventLog.cs
- RelationshipWrapper.cs
- DataExchangeServiceBinder.cs
- DBAsyncResult.cs
- ConnectionPointGlyph.cs
- PassportAuthenticationModule.cs
- ApplicationDirectoryMembershipCondition.cs