public static bool SetObject <T>(this IProjectItem notifier, IProjectItem container, string propertyName, ref T newValue, string propertyNotifierName) where T : class { var propertyInfo = container.GetType().GetProperty(propertyName); var oldValue = (T)propertyInfo.GetValue(container, null); propertyInfo.SetValue(container, newValue, null); var result = notifier.SetObject(ref oldValue, ref newValue, propertyNotifierName); return(result); }