Example #1
0
        public PropertyWrapper(string propertyName)
        {
            var ownerType = typeof(TOwner);
            const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;

            PropertyInfo = TypeUtils.AllBaseTypesAndInterfaces(ownerType)
                           .Select(t => t.GetProperty(propertyName, bindingFlags))
                           .FirstOrDefault(t => t != null);

            if (PropertyInfo == null)
            {
                throw new MissingMemberException($"Could not wrap property {propertyName}.");
            }
        }