public bool VerifyRequired(out string error)
{
error = string.Empty;
if (detailed.Count < 0)
{
error += "detailed is null";
return false;
}
var proInfo = this.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).ToList();
var notCon = new string[] { "detailed" , "vexplain" };
var sb = new StringBuilder();
foreach (var item in proInfo)
{
if (notCon.Contains(item.Name))
continue;
var sv = item.GetValue(this);
if (sv == null)
sb.Append($"【{item.Name}】");
}
detailed.First().VerifyRequired(ref sb);
if (string.IsNullOrWhiteSpace(sb.ToString()))
return true;
error = $"{ sb.ToString()}不能为空或在指定范围!";
return false;
}
public void VerifyRequired(ref StringBuilder sb) { var proInfo = this.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).ToList(); var notCon = new string[] { "remark" }; foreach (var item in proInfo) { if (notCon.Contains(item.Name)) continue; var sv = item.GetValue(this); if (sv == null) sb.Append($"【{item.Name}】"); } }
讓眾人的薪枝構起這團熱情的火焰
浙公网安备 33010602011771号