1. 程式人生 > >Core在類中註入

Core在類中註入

don new vid dht cor helper sta .get on()

private readonly IHttpClientFactory _iHttpClientFactory;
public static NetHelper Get = new NetHelper();
public NetHelper()
{
var serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient();
var service = serviceCollection.BuildServiceProvider();

_iHttpClientFactory = service.GetService<IHttpClientFactory>();

}

Core在類中註入