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
- MSAANativeProvider.cs
- DataControlFieldCollection.cs
- GestureRecognitionResult.cs
- SafeNativeMethods.cs
- ThreadStateException.cs
- DbDataRecord.cs
- TableStyle.cs
- SystemUnicastIPAddressInformation.cs
- CroppedBitmap.cs
- SchemaTypeEmitter.cs
- InArgument.cs
- DBPropSet.cs
- DocumentApplicationJournalEntry.cs
- MimePart.cs
- XmlSchemaAnyAttribute.cs
- PackageDigitalSignature.cs
- FileLogRecordEnumerator.cs
- PictureBox.cs
- InternalsVisibleToAttribute.cs
- CryptoApi.cs
- MachineKeyConverter.cs
- ReferentialConstraint.cs
- EntityDataSourceMemberPath.cs
- CheckBoxField.cs
- StrokeNodeData.cs
- GradientBrush.cs
- UpdatePanelTriggerCollection.cs
- EventWaitHandle.cs
- SimpleTypeResolver.cs
- DllNotFoundException.cs
- TraceInternal.cs
- EdmPropertyAttribute.cs
- WebPartMovingEventArgs.cs
- ExpressionConverter.cs
- TreeView.cs
- DataGridViewComboBoxColumn.cs
- SqlMethodAttribute.cs
- ProgressBarRenderer.cs
- SqlDataSourceSelectingEventArgs.cs
- HttpContext.cs
- CompilationUnit.cs
- ThicknessKeyFrameCollection.cs
- MsmqTransportSecurity.cs
- SqlColumnizer.cs
- TemplateAction.cs
- PagerSettings.cs
- PenThreadWorker.cs
- CngAlgorithmGroup.cs
- SessionStateSection.cs
- DataObjectCopyingEventArgs.cs
- SafeNativeMethodsMilCoreApi.cs
- BehaviorDragDropEventArgs.cs
- BoundField.cs
- WindowsListViewItem.cs
- PTManager.cs
- TemplateBindingExtension.cs
- ZipIOLocalFileHeader.cs
- DetailsViewCommandEventArgs.cs
- CapacityStreamGeometryContext.cs
- DiscoveryClient.cs
- TextTreePropertyUndoUnit.cs
- CompilerError.cs
- HttpRequestCacheValidator.cs
- LocalizableResourceBuilder.cs
- TraceListeners.cs
- Graphics.cs
- BufferAllocator.cs
- MasterPageParser.cs
- _SslSessionsCache.cs
- X509LogoTypeExtension.cs
- StringSorter.cs
- CodeCommentStatement.cs
- OleDbDataReader.cs
- ParenthesizePropertyNameAttribute.cs
- SizeFConverter.cs
- ArrayList.cs
- XmlArrayItemAttributes.cs
- ScaleTransform3D.cs
- QueryCursorEventArgs.cs
- GlobalizationSection.cs
- SortableBindingList.cs
- SpeechRecognizer.cs
- OdbcParameterCollection.cs
- cookiecollection.cs
- WebPartDescriptionCollection.cs
- MimeWriter.cs
- HighlightComponent.cs
- XPathItem.cs
- ProgressBar.cs
- tooltip.cs
- EventProvider.cs
- WebPartTransformer.cs
- Int64Converter.cs
- NameSpaceEvent.cs
- PrePostDescendentsWalker.cs
- GB18030Encoding.cs
- AbstractSvcMapFileLoader.cs
- TextViewBase.cs
- CodeConditionStatement.cs
- ComponentCodeDomSerializer.cs