Context.Current.Session[startDate] = value; } }
/// <summary> /// EndDate is the latest date used to filter records. /// </summary> public static DateTime EndDate { get { if (HttpContext.Current.Session[endDate] == null) return DateTime.MaxValue; else return (DateTime)HttpContext.Current.Session[endDate]; }
set { HttpContext.Current.Session[endDate] = value; } } //--------------------------------------------------------------------- # endregion }
The class demonstrates the use of property getters that can provide default values if a value has not been explicitly stored. For example, the StartDate property provides DateTime.MinValue as a default.
The property getter for the UserAuthorisation property provides a simple cache of the UserAuthorisation class instance, ensuring that the instance in 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页 |