I have an extension method here like this:
public static class Extensions
{
public static System.Windows.DependencyObject SetToolTip(this System.Windows.DependencyObject element, object value)
{
System.Windows.Controls.ToolTipService.SetToolTip(element, value);
return element;
}
}
now when I convert it into a generic method. I get en compile time error. Error 1 Cannot convert type 'System.Windows.DependencyObject' to 'T' Extensions.cs 149 16
public static class Extensions
{
public static T SetToolTip<T>(this System.Windows.DependencyObject element, object value)
{
System.Windows.Controls.ToolTipService.SetToolTip(element, value);
return (T)element;
}
}
any ideas how to resolve this issue?
or even better
(not sure about the last; EDIT: checked, it works.)