private object GetDependentPropertyValue(object container) { var currentType = container.GetType(); var value = container; foreach (string propertyName in DependentProperty.Split('.')) { var property = currentType.GetProperty(propertyName); value = property.GetValue(value, null); currentType = property.PropertyType; } return(value); }
private object GetDependentPropertyValue(object container) { if (container == null) { throw new ArgumentNullException(nameof(container)); } var currentType = container.GetType(); var value = container; foreach (string propertyName in DependentProperty.Split('.')) { var property = currentType.GetProperty(propertyName); if (property != null) { value = property.GetValue(value, null); currentType = property.PropertyType; } } return(value); }