mercredi 20 juillet 2016

Unable to find Interface in C# using reflection with Name.EndsWith

The name of interface is IService, but when I am trying to find the Interface in reflection in C#, it is not able to find because due to some reason the Interface name changes to Iservice'1

Please have a look to attached screenshot for Ildasm :

enter image description here

Actual Interface is like

 public interface IService<TOutput> 
        where TOutput : class, new()
    {
        Task<List<TOutput>> GetAllAsync(dynamic inputParameter);
    }

Code to find Interface: builder.RegisterAssemblyTypes(Assembly.Load("Services")) .Where(t => t.Name.EndsWith("Service"))

Here it fails to find Service, as IService is having some different name then defined one.

Any Idea why the name looks this way and how to resolve it ?





Aucun commentaire:

Enregistrer un commentaire