public IEnumerable<SelectListViewModel> GetDynamicTabSelectList()
{
var rslt=
new DirectoryInfo(Resources.DynamicTabFilePath).GetFiles()
.Select(d =>
new SelectListViewModel
{
//ID = d.id,
Name = d.Name
})
.AsEnumerable();
return rslt;
}
get file with extension
Name = d.Name
get file without extension
Name = Path.GetFileNameWithoutExtension(d.Name)
Reference:
http://www.csharp-examples.net/get-files-from-directory/
No comments:
Post a Comment