コード例 #1
0
ファイル: Shield.cs プロジェクト: lanicon/Shielded
        /// <summary>
        /// Executes the delegate in a context where every read returns the value as
        /// it was at transaction opening. Writes still work, even though their
        /// effects cannot be seen in this context. And please note that
        /// <see cref="Shielded&lt;T&gt;.Modify"/> will not be affected and will expose
        /// the last written value.
        /// </summary>
        public static T ReadOldState <T>(Func <T> act)
        {
            T retVal = default(T);

            Shield.ReadOldState(() => { retVal = act(); });
            return(retVal);
        }