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(List errors) {
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(List errors) {
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
- AppDomainFactory.cs
- EntityConnection.cs
- mda.cs
- VersionPair.cs
- IsolatedStorageException.cs
- StrongNameMembershipCondition.cs
- IpcClientManager.cs
- DataServiceProviderMethods.cs
- MinimizableAttributeTypeConverter.cs
- clipboard.cs
- ModuleBuilder.cs
- RequestCacheValidator.cs
- ReachVisualSerializer.cs
- ErrorProvider.cs
- CalendarTable.cs
- AliasedSlot.cs
- FontCacheUtil.cs
- ServiceDocumentFormatter.cs
- SerialPort.cs
- PolyLineSegment.cs
- RootBrowserWindowProxy.cs
- DbParameterHelper.cs
- ResolveResponseInfo.cs
- MemberCollection.cs
- PropertyChangedEventManager.cs
- UnauthorizedAccessException.cs
- DataGridViewCellValidatingEventArgs.cs
- TextSegment.cs
- ConstraintCollection.cs
- UseLicense.cs
- ClientTarget.cs
- XmlSchemaGroupRef.cs
- TableRow.cs
- CodeAccessSecurityEngine.cs
- UpDownEvent.cs
- Brush.cs
- AdornerLayer.cs
- EventManager.cs
- ObjectConverter.cs
- OracleTransaction.cs
- RectangleGeometry.cs
- SortFieldComparer.cs
- PropertyInfoSet.cs
- HashCoreRequest.cs
- Speller.cs
- StringValueConverter.cs
- ComponentManagerBroker.cs
- ListManagerBindingsCollection.cs
- AuthenticationServiceManager.cs
- ResourceExpression.cs
- InfoCardBinaryReader.cs
- Crc32.cs
- TimelineGroup.cs
- path.cs
- ControlTemplate.cs
- _NestedSingleAsyncResult.cs
- SpinWait.cs
- bindurihelper.cs
- DbDeleteCommandTree.cs
- HtmlTitle.cs
- TreeNode.cs
- TypeInitializationException.cs
- AttachedPropertyMethodSelector.cs
- XNodeValidator.cs
- metadatamappinghashervisitor.cs
- SupportingTokenProviderSpecification.cs
- DesignerHelpers.cs
- TablePatternIdentifiers.cs
- ListItemCollection.cs
- CompilationRelaxations.cs
- WsrmMessageInfo.cs
- AffineTransform3D.cs
- CreatingCookieEventArgs.cs
- TextDecorationLocationValidation.cs
- HttpModuleActionCollection.cs
- counter.cs
- TypographyProperties.cs
- WsdlImporterElementCollection.cs
- LambdaExpression.cs
- EncodingInfo.cs
- WebServiceParameterData.cs
- ExtendedPropertyCollection.cs
- HttpListenerTimeoutManager.cs
- SoundPlayer.cs
- Cloud.cs
- StateMachine.cs
- TablePatternIdentifiers.cs
- FileCodeGroup.cs
- TimeSpanStorage.cs
- RuntimeConfig.cs
- MatrixTransform.cs
- isolationinterop.cs
- NetWebProxyFinder.cs
- TagElement.cs
- ResourcesBuildProvider.cs
- TypeRefElement.cs
- MimePart.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SweepDirectionValidation.cs
- ScrollProviderWrapper.cs