TrackingStringDictionary.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Mail / TrackingStringDictionary.cs / 1 / TrackingStringDictionary.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Net 
{ 
    using System;
    using System.Collections; 
    using System.Collections.Specialized;

    internal class TrackingStringDictionary : StringDictionary
    { 
        bool isChanged;
        bool isReadOnly; 
 
        internal TrackingStringDictionary() : this(false)
        { 
        }

        internal TrackingStringDictionary(bool isReadOnly)
        { 
            this.isReadOnly = isReadOnly;
        } 
 
        internal bool IsChanged
        { 
            get
            {
                return this.isChanged;
            } 
            set
            { 
                this.isChanged = value; 
            }
        } 

        public override void Add(string key, string value)
        {
            if (this.isReadOnly) 
                throw new InvalidOperationException(SR.GetString(SR.MailCollectionIsReadOnly));
 
            base.Add (key, value); 
            this.isChanged = true;
        } 

        public override void Clear()
        {
            if (this.isReadOnly) 
                throw new InvalidOperationException(SR.GetString(SR.MailCollectionIsReadOnly));
 
            base.Clear (); 
            this.isChanged = true;
        } 

        public override void Remove(string key)
        {
            if (this.isReadOnly) 
                throw new InvalidOperationException(SR.GetString(SR.MailCollectionIsReadOnly));
 
            base.Remove (key); 
            this.isChanged = true;
        } 

        public override string this[string key]
        {
            get 
            {
                return base[key]; 
            } 
            set
            { 
                if (this.isReadOnly)
                    throw new InvalidOperationException(SR.GetString(SR.MailCollectionIsReadOnly));

                base[key] = value; 
                this.isChanged = true;
            } 
        } 
    }
} 


                        

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