/// <summary> /// Tries to get a <see cref="DpiInfo" /> object from the prebuilt cache. /// </summary> /// <param name="monitor">An opaque handle to the monitor.</param> /// <param name="info">The cached object.</param> /// <returns>True when the object was retrieved from cache successfully.</returns> public static bool TryGetFromCache(IntPtr monitor, out DpiInfo info) { if (_dpiIndexLookup.TryGetValue(monitor, out var index)) { return(TryGetFromCache(index, out info)); } info = null; return(false); }
/// <summary> /// Tries to get a <see cref="DpiInfo" /> object from the prebuilt cache. /// </summary> /// <param name="index">The monitor index of the object.</param> /// <param name="info">The cached object.</param> /// <returns>True when the object was retrieved from cache successfully.</returns> public static bool TryGetFromCache(int index, out DpiInfo info) { if (CheckCache()) { info = _dpiInfos.ElementAtOrDefault(index); } else { info = null; } return(info != null); }