Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / ErrorsHelper.cs / 1305376 / 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
- ApplicationHost.cs
- StringValidator.cs
- ValidatingReaderNodeData.cs
- DictionarySectionHandler.cs
- HttpInputStream.cs
- MonthCalendar.cs
- DocumentXmlWriter.cs
- Decoder.cs
- LoadedOrUnloadedOperation.cs
- NamespaceCollection.cs
- DbProviderFactory.cs
- DbConnectionPoolGroupProviderInfo.cs
- Size3D.cs
- Tuple.cs
- RemoteTokenFactory.cs
- WindowsFormsSynchronizationContext.cs
- DataViewSettingCollection.cs
- TdsParserSessionPool.cs
- LateBoundBitmapDecoder.cs
- TextServicesManager.cs
- mansign.cs
- SingleAnimationUsingKeyFrames.cs
- ExternalException.cs
- Parameter.cs
- StringFormat.cs
- PrintDialog.cs
- StateDesigner.cs
- ToolStripItemTextRenderEventArgs.cs
- XmlHierarchicalDataSourceView.cs
- DbReferenceCollection.cs
- MailHeaderInfo.cs
- SpecialFolderEnumConverter.cs
- OleDbSchemaGuid.cs
- PromptBuilder.cs
- VectorConverter.cs
- TextCompositionManager.cs
- wpf-etw.cs
- MarginCollapsingState.cs
- UrlMappingsModule.cs
- CapabilitiesUse.cs
- SafeRegistryHandle.cs
- DesignerTransactionCloseEvent.cs
- LayoutEngine.cs
- Hash.cs
- DataGridViewRowEventArgs.cs
- LocalFileSettingsProvider.cs
- listitem.cs
- ChannelDispatcherCollection.cs
- ServiceOperationInvoker.cs
- SweepDirectionValidation.cs
- CacheMemory.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- DataMemberAttribute.cs
- KeyGesture.cs
- QueryCacheKey.cs
- ResourceWriter.cs
- XPathScanner.cs
- ToolStripDropDownClosingEventArgs.cs
- FormattedText.cs
- Math.cs
- CodeCatchClause.cs
- SqlStream.cs
- PersonalizationDictionary.cs
- ExecutionTracker.cs
- OleDbWrapper.cs
- DataServiceQueryProvider.cs
- xsdvalidator.cs
- ExitEventArgs.cs
- TripleDES.cs
- SqlDeflator.cs
- PreDigestedSignedInfo.cs
- DrawToolTipEventArgs.cs
- AsnEncodedData.cs
- IPEndPointCollection.cs
- MasterPageBuildProvider.cs
- DataGridViewRowCancelEventArgs.cs
- DataSourceControl.cs
- SiteMapNodeItem.cs
- StringBuilder.cs
- FeatureSupport.cs
- SchemaNamespaceManager.cs
- WorkflowDefinitionContext.cs
- Latin1Encoding.cs
- documentsequencetextview.cs
- SingleSelectRootGridEntry.cs
- DateTimeFormatInfo.cs
- _SecureChannel.cs
- ContentIterators.cs
- VisualTarget.cs
- SqlBulkCopy.cs
- SqlConnectionString.cs
- MouseActionConverter.cs
- XPathItem.cs
- sortedlist.cs
- ColorMap.cs
- ContextProperty.cs
- CaseStatement.cs
- UpdateException.cs
- ProtocolsConfigurationEntry.cs
- EndpointNotFoundException.cs