Performance improvements in EmailAddressAttribute (dotnet/corefx#36994)
authorPonant <19961806+Ponant@users.noreply.github.com>
Fri, 19 Apr 2019 04:14:10 +0000 (06:14 +0200)
committerStephen Toub <stoub@microsoft.com>
Fri, 19 Apr 2019 04:14:10 +0000 (00:14 -0400)
commit8e6e5fc9bccbeff7bbef88f0d6d0396759d90526
tree6dc16402e165c5f3cbdf5146417199dc7a81c839
parente62df9a456537db06430115e0adc9db6d4ba12fd
Performance improvements in EmailAddressAttribute (dotnet/corefx#36994)

* performance improvements by a factor of 2 to 10

I get a perf improvement by using IndexOf which ranges from a a factor of two for an email address having 20 char to nearly 10 for 60 char.

* Update src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs

force explicit type

* Simplify code

Commit migrated from https://github.com/dotnet/corefx/commit/556e080cce3bbd075f7199286b33842f5c0a0c61
src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/EmailAddressAttribute.cs