Currently, when a MaskedTextBox is emptied while the includeLiterals property is set to true, the control returns a string that still contains the literals defined by the mask. This behavior makes it difficult to distinguish between a genuinely empty input and one that contains only literals.
Expected behavior:
When the user clears the input, the MaskedTextBox should return either an empty string ("") or null, even if includeLiterals = true.
Suggested improvement:
Introduce an option on the MaskedTextBox that lets developers choose the desired behavior when clearing:
Keep literals (current behavior),
or Return empty string / null (proposed behavior).
Why this matters:
It complicates validation and data processing, as developers need to add extra logic to detect and strip literals.
In many real-world scenarios, an empty field should semantically represent no input, not a string with placeholder characters.
Making this configurable would give developers flexibility without breaking existing behavior.
Reproducible example:
I’ve created a working example in StackBlitz that demonstrates the issue.