// Copyright (c) Arlo Godfrey. All Rights Reserved.
// Licensed under the GNU Lesser General Public License, Version 3.0 with additional terms.
// See the LICENSE, LICENSE.LESSER and LICENSE.ADDITIONAL files in the project root for more information.
using System.Globalization;
using StrixMusic.Sdk.BaseModels;
namespace StrixMusic.Sdk.ViewModels.Helpers.Comparers
{
///
/// A class that can compare names.
///
public sealed class NameComparer : InversableComparer
where TPlayableBase : IPlayableBase
{
///
/// Initializes a new instance of the class.
///
/// Sets if the comparer operates in descending order.
public NameComparer(bool isDescending = false) : base(isDescending)
{
}
///
public override int Compare(TPlayableBase x, TPlayableBase y)
{
int value = string.Compare(x.Name, y.Name, false, CultureInfo.CurrentCulture);
return IsDescending ? -value : value;
}
}
}