Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的一个属性有以下数据注释:
[RegularExpression(@"A|B|C|A and B", ErrorMessage = "You must select one.")]
当我提交值“A 和 B”时,它不接受这一点,但如果我发布“A”、“B”或“C”,它就会通过。我将如何做到这一点,以便完整的字符串“A 和 B”将接受。
将“A和B”放在括号中:
[RegularExpression(@"A|B|C|(A and B)", ErrorMessage = "You must select one.")]