Some changes I made (after noticing a few issues with it):
ExtraClasses
has no need to be a field and a property; replaced both withpublic List<string> ExtraClasses { get; } = new List<string>();
.- Since
GetBodyDivContent
is notstatic
, I made removedextraClasses
from the parameter, and made it directly used in the method. - I extracted a lot of
Validate
out to otherprotected
methods. - I replaced
ParseJson
withTryParseJson
as per RobH's RobH's answer answer.
Version as of this answer: ReCaptchaValidator.cs
Some changes I made (after noticing a few issues with it):
ExtraClasses
has no need to be a field and a property; replaced both withpublic List<string> ExtraClasses { get; } = new List<string>();
.- Since
GetBodyDivContent
is notstatic
, I made removedextraClasses
from the parameter, and made it directly used in the method. - I extracted a lot of
Validate
out to otherprotected
methods. - I replaced
ParseJson
withTryParseJson
as per RobH's answer.
Version as of this answer: ReCaptchaValidator.cs
Some changes I made (after noticing a few issues with it):
ExtraClasses
has no need to be a field and a property; replaced both withpublic List<string> ExtraClasses { get; } = new List<string>();
.- Since
GetBodyDivContent
is notstatic
, I made removedextraClasses
from the parameter, and made it directly used in the method. - I extracted a lot of
Validate
out to otherprotected
methods. - I replaced
ParseJson
withTryParseJson
as per RobH's answer.
Version as of this answer: ReCaptchaValidator.cs
Some changes I made (after noticing a few issues with it):
ExtraClasses
has no need to be a field and a property; replaced both withpublic List<string> ExtraClasses { get; } = new List<string>();
.- Since
GetBodyDivContent
is notstatic
, I made removedextraClasses
from the parameter, and made it directly used in the method. - I extracted a lot of
Validate
out to otherprotected
methods. - I replaced
ParseJson
withTryParseJson
as per RobH's answer.
Version as of this answer: ReCaptchaValidator.cs