/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Mvc/Mvc.DataAnnotations/test/ModelValidationResultComparer.cs
33 строки
1011 B
James Newton-King
Enable throw helper analyzers (#45954)
10 янв 2023, 03:52
Не верифицирован
10 янв 2023, 03:52
c096dbb
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace Microsoft.AspNetCore.Mvc.DataAnnotations; public class ModelValidationResultComparer : IEqualityComparer<ModelValidationResult> { public static readonly ModelValidationResultComparer Instance = new ModelValidationResultComparer(); private ModelValidationResultComparer() { } public bool Equals(ModelValidationResult x, ModelValidationResult y) { if (x == null || y == null) { return x == null && y == null; } return string.Equals(x.MemberName, y.MemberName, StringComparison.Ordinal) && string.Equals(x.Message, y.Message, StringComparison.Ordinal); } public int GetHashCode(ModelValidationResult obj) { ArgumentNullException.ThrowIfNull(obj); return obj.MemberName.GetHashCode(); } }