1 //------------------------------------------------------------------------------
2 // <copyright file="StateItem.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //------------------------------------------------------------------------------
6 
7 namespace System.Web.UI {
8 
9     using System;
10 
11     /*
12      * The StateItem class * by the StateBag class.
13      * The StateItem has an object value, a dirty flag.
14      */
15 
16     /// <devdoc>
17     /// <para>Represents an item that is saved in the <see cref='System.Web.UI.StateBag'/> class when view state
18     ///    information is persisted between Web requests.</para>
19     /// </devdoc>
20     public sealed class StateItem {
21         private object      value;
22         private bool        isDirty;
23 
24         /*
25          * Constructs a StateItem with an initial value.
26          */
StateItem(object initialValue)27         internal StateItem(object initialValue) {
28             value = initialValue;
29             isDirty = false;
30         }
31 
32         /*
33          * Property to indicate StateItem has been modified.
34          */
35 
36         /// <devdoc>
37         /// <para>Indicates whether the <see cref='System.Web.UI.StateItem'/> object has been modified.</para>
38         /// </devdoc>
39         public bool IsDirty {
40             get {
41                 return isDirty;
42             }
43             set {
44                 isDirty = value;
45             }
46         }
47 
48         /*
49          * Property to access the StateItem value.
50          */
51 
52         /// <devdoc>
53         /// <para>Indicates the value of the item that is stored in the <see cref='System.Web.UI.StateBag'/>
54         /// object.</para>
55         /// </devdoc>
56         public object Value {
57             get {
58                 return value;
59             }
60             set {
61                 this.value = value;
62             }
63         }
64     }
65 }
66