diff --git a/aspnetcore/mvc/models/validation/sample/Attributes/CustomValidationAttributeAdapterProvider.cs b/aspnetcore/mvc/models/validation/sample/Attributes/CustomValidationAttributeAdapterProvider.cs index e271605839..acacddb399 100644 --- a/aspnetcore/mvc/models/validation/sample/Attributes/CustomValidationAttributeAdapterProvider.cs +++ b/aspnetcore/mvc/models/validation/sample/Attributes/CustomValidationAttributeAdapterProvider.cs @@ -18,10 +18,9 @@ namespace ValidationSample.Attributes public IAttributeAdapter GetAttributeAdapter(ValidationAttribute attribute, IStringLocalizer stringLocalizer) { - if (attribute is ClassicMovieAttribute) + if (attribute is ClassicMovieAttribute classicMovieAttribute) { - return new ClassicMovieAttributeAdapter( - attribute as ClassicMovieAttribute, stringLocalizer); + return new ClassicMovieAttributeAdapter(classicMovieAttribute, stringLocalizer); } else {