ExceptionCollection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / Host / ExceptionCollection.cs / 1 / ExceptionCollection.cs

                             
//------------------------------------------------------------------------------
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
//  
//-----------------------------------------------------------------------------
 
namespace System.ComponentModel.Design { 

    using System; 
    using System.Collections;
    using System.Runtime.Serialization;
    using System.Security.Permissions;
 
    [Serializable]
    public sealed class ExceptionCollection : Exception { 
        ArrayList exceptions; 

        public ExceptionCollection(ArrayList exceptions) { 
            this.exceptions = exceptions;
        }

        ///  
        ///     Need this constructor since Exception implements ISerializable.
        ///  
        private ExceptionCollection(SerializationInfo info, StreamingContext context) : base (info, context) { 
            exceptions = (ArrayList) info.GetValue("exceptions", typeof(ArrayList));
        } 

        public ArrayList Exceptions {
            get {
                if (exceptions != null) { 
                    return (ArrayList) exceptions.Clone();
                } 
 
                return null;
            } 
        }

        /// 
        ///     Need this since Exception implements ISerializable and we have fields to save out. 
        /// 
        [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] 
        public override void GetObjectData(SerializationInfo info, StreamingContext context) { 
            if (info == null) {
                throw new ArgumentNullException("info"); 
            }

            info.AddValue("exceptions", exceptions);
 
            base.GetObjectData(info, context);
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK