/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs
71 строка
2 KB
CarloToso
Replace ArgumentNullException(nameof()) -> ArgumentNullException.ThrowIfNull() (#18784)
14 дек 2022, 16:30
Не верифицирован
14 дек 2022, 16:30
2ddc63f
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Windows; using System.Windows.Data; namespace Microsoft.Management.UI.Internal { /// <summary> /// Takes two objects and determines whether they are equal. /// </summary> [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] public class IsEqualConverter : IMultiValueConverter { /// <summary> /// Takes two items and determines whether they are equal. /// </summary> /// <param name="values"> /// Two objects of any type. /// </param> /// <param name="targetType">The parameter is not used.</param> /// <param name="parameter">The parameter is not used.</param> /// <param name="culture">The parameter is not used.</param> /// <returns> /// True if-and-only-if the two objects are equal per Object.Equals(). /// Null is equal only to null. /// </returns> public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ArgumentNullException.ThrowIfNull(values); if (values.Length != 2) { throw new ArgumentException("Two values expected", "values"); } object item1 = values[0]; object item2 = values[1]; if (item1 == null) { return item2 == null; } if (item2 == null) { return false; } bool equal = item1.Equals(item2); return equal; } /// <summary> /// This method is not used. /// </summary> /// <param name="value">The parameter is not used.</param> /// <param name="targetTypes">The parameter is not used.</param> /// <param name="parameter">The parameter is not used.</param> /// <param name="culture">The parameter is not used.</param> /// <returns>The parameter is not used.</returns> public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }