// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Runtime.CompilerServices; using Microsoft.UI.Xaml; namespace CommunityToolkit.WinUI.UI.Predicates { /// /// An type matching instances by name. /// internal readonly struct PredicateByName : IPredicate { /// /// The name of the element to look for. /// private readonly string name; /// /// The comparison type to use to match . /// private readonly StringComparison comparisonType; /// /// Initializes a new instance of the struct. /// /// The name of the element to look for. /// The comparison type to use to match . public PredicateByName(string name, StringComparison comparisonType) { this.name = name; this.comparisonType = comparisonType; } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Match(FrameworkElement element) { return element.Name.Equals(this.name, this.comparisonType); } } }