diff --git a/src/Directory.build.props b/src/Directory.build.props
index 759d0e86..a20bb13d 100644
--- a/src/Directory.build.props
+++ b/src/Directory.build.props
@@ -27,7 +27,7 @@
preview
True
latest
- $(NoWarn);IDE1006
+ $(NoWarn);IDE1006;IDE0130
@@ -48,4 +48,4 @@
-
\ No newline at end of file
+
diff --git a/src/ReactiveUI.Validation.AndroidX/Extensions/ViewForExtensions.cs b/src/ReactiveUI.Validation.AndroidX/Extensions/ViewForExtensions.cs
index e4212671..de9c5536 100644
--- a/src/ReactiveUI.Validation.AndroidX/Extensions/ViewForExtensions.cs
+++ b/src/ReactiveUI.Validation.AndroidX/Extensions/ViewForExtensions.cs
@@ -15,7 +15,6 @@
using ReactiveUI.Validation.ValidationBindings;
using Splat;
-// ReSharper disable once CheckNamespace
namespace ReactiveUI.Validation.Extensions;
///
@@ -40,7 +39,6 @@ public static class ViewForExtensions
/// IValidationTextFormatter<string> into Splat.Locator.
///
/// Returns a object.
- [SuppressMessage("Design", "CA1801: Parameter unused", Justification = "Used for generic resolution.")]
public static IDisposable BindValidation(
this TView view,
TViewModel? viewModel,
@@ -50,74 +48,11 @@ public static IDisposable BindValidation(
where TView : IViewFor
where TViewModel : class, IReactiveObject, IValidatableViewModel
{
- if (view is null)
- {
- throw new ArgumentNullException(nameof(view));
- }
+ ArgumentNullException.ThrowIfNull(view);
- if (viewModelProperty is null)
- {
- throw new ArgumentNullException(nameof(viewModelProperty));
- }
+ ArgumentNullException.ThrowIfNull(viewModelProperty);
- if (viewProperty is null)
- {
- throw new ArgumentNullException(nameof(viewProperty));
- }
-
- formatter ??= Locator.Current.GetService>() ??
- SingleLineFormatter.Default;
-
- return ValidationBinding.ForProperty(
- view,
- viewModelProperty,
- (_, errors) => viewProperty.Error = errors.FirstOrDefault(msg => !string.IsNullOrEmpty(msg)),
- formatter);
- }
-
- ///
- /// Platform binding to the TextInputLayout.
- ///
- /// Supports multiple validations for the same property.
- /// IViewFor of TViewModel.
- /// ViewModel type.
- /// ViewModel property type.
- /// IViewFor instance.
- /// ViewModel instance. Can be null, used for generic type resolution.
- /// ViewModel property.
- /// View property to bind the validation message.
- ///
- /// Validation formatter. Defaults to . In order to override the global
- /// default value, implement and register an instance of
- /// IValidationTextFormatter<string> into Splat.Locator.
- ///
- /// Returns a object.
- [ExcludeFromCodeCoverage]
- [Obsolete("This method is no longer required, BindValidation now supports multiple validations.")]
- [SuppressMessage("Design", "CA1801: Parameter unused", Justification = "Used for generic resolution.")]
- public static IDisposable BindValidationEx(
- this TView view,
- TViewModel? viewModel,
- Expression> viewModelProperty,
- TextInputLayout viewProperty,
- IValidationTextFormatter? formatter = null)
- where TView : IViewFor
- where TViewModel : class, IReactiveObject, IValidatableViewModel
- {
- if (view is null)
- {
- throw new ArgumentNullException(nameof(view));
- }
-
- if (viewModelProperty is null)
- {
- throw new ArgumentNullException(nameof(viewModelProperty));
- }
-
- if (viewProperty is null)
- {
- throw new ArgumentNullException(nameof(viewProperty));
- }
+ ArgumentNullException.ThrowIfNull(viewProperty);
formatter ??= Locator.Current.GetService>() ??
SingleLineFormatter.Default;
@@ -144,7 +79,6 @@ public static IDisposable BindValidationEx
/// Returns a object.
- [SuppressMessage("Design", "CA1801: Parameter unused", Justification = "Used for generic resolution.")]
public static IDisposable BindValidation(
this TView view,
TViewModel? viewModel,
@@ -154,20 +88,11 @@ public static IDisposable BindValidation(
where TView : IViewFor
where TViewModel : class, IReactiveObject, IValidatableViewModel
{
- if (view is null)
- {
- throw new ArgumentNullException(nameof(view));
- }
+ ArgumentNullException.ThrowIfNull(view);
- if (viewModelHelperProperty is null)
- {
- throw new ArgumentNullException(nameof(viewModelHelperProperty));
- }
+ ArgumentNullException.ThrowIfNull(viewModelHelperProperty);
- if (viewProperty is null)
- {
- throw new ArgumentNullException(nameof(viewProperty));
- }
+ ArgumentNullException.ThrowIfNull(viewProperty);
formatter ??= Locator.Current.GetService>() ??
SingleLineFormatter.Default;