Add project files.

This commit is contained in:
Daniel Clark
2022-11-01 15:26:08 +00:00
parent daa7b59f22
commit 7e4f880821
408 changed files with 16863 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Concurrent;
using System.Reactive.Disposables;
namespace TheXamlGuy.Framework.Core
{
public class Scope : IScope
{
private readonly ConcurrentDictionary<object, bool> scopes = new ConcurrentDictionary<object, bool>();
public IDisposable Enter<T>(object target)
{
scopes.TryAdd(Tuple.Create(target, typeof(T)), true);
return Disposable.Create(() => scopes.TryRemove(Tuple.Create(target, typeof(T)), out bool value));
}
public bool IsActive<T>(object target)
{
return scopes.ContainsKey(Tuple.Create(target, typeof(T)));
}
}
}