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
- ObjectAnimationBase.cs
- NotEqual.cs
- InertiaTranslationBehavior.cs
- BaseValidator.cs
- Delegate.cs
- SqlBuilder.cs
- XmlDataCollection.cs
- ThreadInterruptedException.cs
- ShortcutKeysEditor.cs
- EntityModelBuildProvider.cs
- WindowsGraphicsWrapper.cs
- StoryFragments.cs
- GridProviderWrapper.cs
- XmlComplianceUtil.cs
- NumberSubstitution.cs
- FilterableAttribute.cs
- CommentAction.cs
- EventProviderWriter.cs
- XsdCachingReader.cs
- DateTimeConverter.cs
- UpdateManifestForBrowserApplication.cs
- OdbcConnectionStringbuilder.cs
- FontStyles.cs
- ExceptionUtil.cs
- QueryContinueDragEvent.cs
- CodeAssignStatement.cs
- PartialTrustHelpers.cs
- QuaternionKeyFrameCollection.cs
- BindingElementCollection.cs
- PeerApplicationLaunchInfo.cs
- ProfilePropertySettings.cs
- LineSegment.cs
- SelectionProviderWrapper.cs
- DataAdapter.cs
- CompiledIdentityConstraint.cs
- FontConverter.cs
- MemoryMappedViewStream.cs
- ModifierKeysConverter.cs
- CachedPathData.cs
- ObjectTag.cs
- SystemIPInterfaceStatistics.cs
- ActiveDocumentEvent.cs
- XmlAnyElementAttributes.cs
- TypeLoader.cs
- RotateTransform3D.cs
- EntityType.cs
- SqlNamer.cs
- DataKey.cs
- Parsers.cs
- Button.cs
- SizeLimitedCache.cs
- DebugView.cs
- RewritingPass.cs
- PropertyGridView.cs
- Pen.cs
- SqlServer2KCompatibilityCheck.cs
- XamlTemplateSerializer.cs
- SqlUdtInfo.cs
- DataGridHeaderBorder.cs
- TraceListener.cs
- ExtendedProtectionPolicyElement.cs
- PrintingPermissionAttribute.cs
- CodePageUtils.cs
- Vector3DAnimationBase.cs
- MailHeaderInfo.cs
- ConfigurationConverterBase.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- OleDbConnectionFactory.cs
- CdpEqualityComparer.cs
- OdbcConnectionStringbuilder.cs
- FamilyMapCollection.cs
- TemplatedMailWebEventProvider.cs
- OdbcParameter.cs
- CommonProperties.cs
- BaseDataListComponentEditor.cs
- Win32.cs
- XmlNodeList.cs
- UpdateExpressionVisitor.cs
- _SslStream.cs
- MethodToken.cs
- Polygon.cs
- ProtocolsConfigurationEntry.cs
- MethodAccessException.cs
- TextViewElement.cs
- XsltException.cs
- DesignerHost.cs
- Camera.cs
- XmlSchemaSequence.cs
- JsonClassDataContract.cs
- RoutingBehavior.cs
- MissingFieldException.cs
- FixedSOMLineCollection.cs
- PostBackTrigger.cs
- ReceiveMessageContent.cs
- Rect3DValueSerializer.cs
- DataGridViewSortCompareEventArgs.cs
- ClientSideQueueItem.cs
- ResourcePermissionBaseEntry.cs
- VisualCollection.cs
- AttachmentCollection.cs