ModelBuilder.ObjectExtensions.FindProperties C# (CSharp) Method

FindProperties() public static method

Finds the properties on the instance that match the specified expression.
The parameter is null. The parameter is null.
public static FindProperties ( this source, Regex expression ) : IEnumerable
source this The source instance.
expression System.Text.RegularExpressions.Regex 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;
        }
    }
ObjectExtensions