小编Phi*_*ler的帖子

如何使用动态模式创建regularExpressionAttribute来自model属性

public class City
{
   [DynamicReqularExpressionAttribute(PatternProperty = "RegEx")]
   public string Zip {get; set;}
   public string RegEx { get; set;} 
}
Run Code Online (Sandbox Code Playgroud)

我想创建这个属性,其中模式来自其他属性,而不像原始的RegularExpressionAttribute那样声明静态.

任何想法将不胜感激 - 谢谢

c# validation attributes asp.net-mvc-3

6
推荐指数
1
解决办法
3339
查看次数

标签 统计

asp.net-mvc-3 ×1

attributes ×1

c# ×1

validation ×1