maui-linux/Xamarin.Forms.Core/IServiceProviderExtensions.cs

13 строки
290 B
C#

namespace Xamarin.Forms.Xaml
{
public static class IServiceProviderExtensions
{
public static T GetService<T>(this System.IServiceProvider provider)
{
var service = provider.GetService(typeof(T));
if (service is T tservice)
return tservice;
return default(T);
}
}
}