/* * ExceptionalList.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace DTS.Common.Utilities { /// /// A version of that provides its own exception type. /// /// /// /// The type of object contained by this list. /// /// /// /// Sample usage: /// public class A : ExceptionalList <int> /// { /// public void ScrewItUp( ) /// { /// private bool error = true; /// if ( error ) throw new A.Exception( "Class A-specific screwup." ); /// } /// } /// /// ... /// /// try /// { /// A.ScrewItUp( ); /// B.ScrewItUp( ); /// C.ScrewItUp( ); /// } /// catch ( A.Exception ex ) /// { /// // Can pick A's exceptions out of a crowd, or not and just treat it /// // polymorphically as a System.Exception. /// } /// /// [global::System.Serializable] public class ExceptionalList : List { /// /// Initialize an instance of the ExceptionalList class. /// public ExceptionalList() : base() { } /// /// Initialize an instance of the ExceptionalList class. /// /// /// /// The number of elements that the list can initially store. /// /// public ExceptionalList(int capacity) : base(capacity) { } /// /// Initialize an instance of the ExceptionalList class. /// /// /// /// The collection whose elements are copied to the new list. /// /// public ExceptionalList(IEnumerable collection) : base(collection) { } /// /// A representation of the DerivedClass.Exception class. /// public class Exception : ApplicationException { public Exception() { } public Exception(string msg) : base(msg) { } public Exception(string msg, System.Exception innerEx) : base(msg, innerEx) { } protected Exception( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } } } }