using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PCUT.Extensions
{
    public static class SettingExtensions
    {
        public static bool TryGetValue<T> (this Windows.Storage.ApplicationDataContainer settings, string key, out T value)
        {
            if (settings.Values.TryGetValue(key, out var obj) && !(obj is null) && obj is T tValue)
            {
                value = tValue;
                return true;
            }
            value = default;
            return false;
        }
    }
}
