/// <summary> /// 参数过滤 /// </summary> /// <param name="parameters"></param> /// <param name="sql"></param> /// <returns></returns> public static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyInfo> parameters, string sql) { return parameters.Where(p => Regex.IsMatch(sql, @"[?@:]" + p.Name + "([^a-z0-9_]+|$)", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.CultureInvariant)); }
原文:http://www.cnblogs.com/litian/p/5731132.html