using System; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using Windows.UI.Xaml.Data; namespace OwlCore.WinUI.Converters.Bools { /// /// A converter that converts checks null checks an object. /// public sealed class NotNullToBoolConverter : IValueConverter { /// /// Checks if an object is null. /// /// The object to check. /// True if not null, false if null [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool Convert(object? obj) => obj != null; /// public object Convert(object value, Type targetType, object parameter, string language) { return Convert(value); } /// public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }