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
- DebugViewWriter.cs
- RectAnimationBase.cs
- ProfileProvider.cs
- InvalidOperationException.cs
- StorageEntitySetMapping.cs
- DataMisalignedException.cs
- CngAlgorithm.cs
- HttpHandlerAction.cs
- DependencyPropertyKey.cs
- StatusBarDrawItemEvent.cs
- AttributeData.cs
- SecurityState.cs
- DispatcherObject.cs
- ClientSideQueueItem.cs
- ISAPIWorkerRequest.cs
- UnsafeNativeMethods.cs
- PopOutPanel.cs
- ChannelSinkStacks.cs
- SemaphoreSecurity.cs
- GreenMethods.cs
- FileDialogCustomPlace.cs
- DoubleAnimationUsingPath.cs
- UIPermission.cs
- PropertyGeneratedEventArgs.cs
- SourceCollection.cs
- SyndicationDeserializer.cs
- OperationParameterInfo.cs
- BamlRecordReader.cs
- InkPresenter.cs
- ObjectCloneHelper.cs
- ApplicationFileCodeDomTreeGenerator.cs
- TemporaryBitmapFile.cs
- GenericIdentity.cs
- MatrixStack.cs
- TreeViewAutomationPeer.cs
- DrawingState.cs
- SurrogateSelector.cs
- IpcPort.cs
- ItemsPanelTemplate.cs
- PackWebRequestFactory.cs
- PropertyDescriptors.cs
- SqlStream.cs
- UpdateTranslator.cs
- UIElementPropertyUndoUnit.cs
- DataGridViewTextBoxEditingControl.cs
- Merger.cs
- WebZone.cs
- ManagedWndProcTracker.cs
- FilterRepeater.cs
- recordstatescratchpad.cs
- StreamUpgradeAcceptor.cs
- DataViewManagerListItemTypeDescriptor.cs
- NativeMethods.cs
- SelectionPatternIdentifiers.cs
- SecurityKeyIdentifier.cs
- Geometry.cs
- XmlSchemaAttribute.cs
- ControlEvent.cs
- DrawingCollection.cs
- RemotingException.cs
- EmptyEnumerable.cs
- TemplateColumn.cs
- OleDbSchemaGuid.cs
- ClassHandlersStore.cs
- SynchronizedInputAdaptor.cs
- AdRotatorDesigner.cs
- CompiledRegexRunnerFactory.cs
- SqlCacheDependencyDatabaseCollection.cs
- RoutedEventConverter.cs
- CompressedStack.cs
- util.cs
- RadioButton.cs
- dataSvcMapFileLoader.cs
- ImmutableCollection.cs
- InternalDispatchObject.cs
- CardSpaceException.cs
- ISO2022Encoding.cs
- ResourceDisplayNameAttribute.cs
- DataBindEngine.cs
- ChangeTracker.cs
- IProvider.cs
- EndCreateSecurityTokenRequest.cs
- ProxyWebPartManagerDesigner.cs
- EntityDesignPluralizationHandler.cs
- SafeNativeMethods.cs
- ToolBar.cs
- CodeBlockBuilder.cs
- WriteStateInfoBase.cs
- XmlSchemaSimpleContentExtension.cs
- WMIGenerator.cs
- MissingMethodException.cs
- CultureTable.cs
- HashCodeCombiner.cs
- SharedPersonalizationStateInfo.cs
- ConnectionsZoneAutoFormat.cs
- TypeDescriptionProvider.cs
- SyndicationLink.cs
- Version.cs
- UriWriter.cs
- HttpCacheVaryByContentEncodings.cs