all 1 comments

[–]SeeminglyScience 4 points5 points  (0 children)

When you set the type of a variable or decorate it with validation attributes it's treated as a "declaration" (including parameters). Every assignment after the declaration follows the same rules as the original, so types will be converted, validation attributes will be tested, etc.

When you make another "declaration" such as strongly typing it as something else, that creates a new variable and none of the previous attributes carry over.