mardi 9 avril 2019

Find Controller DiplayName and Show it

i write this code for find controller list in my project .

    public IEnumerable<Type> GetControllerDescovery(Assembly assemblies)
    {
        var controllers = assemblies.GetExportedTypes()
                                                    .Where(t => typeof(ControllerBase)
                                                    .IsAssignableFrom(t))
                                                    .Select(t => t).
                                                    ToList();
        return controllers;
    }

and it show me this output :

"IranNews.Controllers.V1.CategoryController, IranNews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"IranNews.Controllers.V1.RoleManagerController, IranNews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"IranNews.Controllers.V1.UserController, IranNews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"IranNews.Controllers.V1.ValuesController, IranNews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

but i need to get name of contrller from [Display(Name = "UserManager")]

and show me this : UserManager

how can i do this ?????





Aucun commentaire:

Enregistrer un commentaire