public static FindProperties ( this source, |
||
source | this | The source instance. |
expression | The evaluation expression. | |
return | IEnumerable |
public static IEnumerable<PropertyInfo> FindProperties(this object source, Regex expression)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (expression == null)
{
throw new ArgumentNullException(nameof(expression));
}
return from x in source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
where expression.IsMatch(x.Name)
select x;
}
}