I was going through some old code and came across a hybrid class IValueConverter/ MarkupExtension. I was wondering if the method is useful IServiceProviderin the method ProvideValueand how will it be useful?
I see that there IServiceProvideris only one method: GetServicethat must be assigned to the correct type of service. I also looked at the MarkupExtension.ProvideValue MSDN page and lists various types of services. I think I'm just wondering if any of these services are useful or should I leave my method as it is?
Current Method:
public Object ProvideValue(IServiceProvider serviceProvider)
{
return new MyConverter();
}
Basically, should I do the following:
public Object ProvideValue(IServiceProvider serviceProvider)
{
var provider = serviceProvider as SomeType;
if (provider == null) return new MyConverter();
}