// Static constructor replacement /// <summary> /// Creates and initializes a new <see cref="ThreadSafeCached{T}"/>. /// </summary> /// <param name="syncRoot"><see cref="SyncRoot"/> property value.</param> /// <returns>New initialized <see cref="ThreadSafeCached{T}"/>.</returns> public static ThreadSafeCached <T> Create(object syncRoot) { var result = new ThreadSafeCached <T>(); result.Initialize(syncRoot); return(result); }
/// <inheritdoc/> public bool Equals(ThreadSafeCached <T> other) { if (isCached != other.isCached) { return(false); } return(AdvancedComparerStruct <T> .System.Equals(cachedValue, other.cachedValue)); }
/// <inheritdoc/> public int CompareTo(ThreadSafeCached <T> other) { int result = (isCached ? 1 : 0) - (other.isCached ? 1 : 0); if (result != 0) { return(result); } return(AdvancedComparerStruct <T> .System.Compare(cachedValue, other.cachedValue)); }