vendredi 30 décembre 2016

Call method of lazy generic type with reflection in c#

I want to call close method of _baseInfoService with reflection if IsValueCreated. how can I do it with reflection?

public static partial class ServiceFactory
{
    private static readonly Lazy<ServiceWrapper<IBaseInfoWcfService>> _baseInfoService = 
        new Lazy<ServiceWrapper<IBaseInfoWcfService>>(CreateWrapper<IBaseInfoWcfService>);

    public static IBaseInfoWcfService BaseInfoService => _baseInfoService.Value.Instance;
}





Aucun commentaire:

Enregistrer un commentaire