Files
Toolkit2/Toolkit.Foundation/NavigationContextProvider.cs
T
2024-04-13 11:29:32 +01:00

25 lines
568 B
C#

namespace Toolkit.Foundation;
public class NavigationContextProvider(INavigationContextCollection contexts) :
INavigationContextProvider
{
public object? Get(object key) =>
contexts.TryGetValue(key, out object? target) ? target : default;
public bool TryGet(object name,
out object? value)
{
if (contexts.TryGetValue(name,
out object? target))
{
value = target;
return true;
}
else
{
value = null;
return false;
}
}
}