Click here to Skip to main content
15,896,550 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,
I have a folder with 50 files . I need to retrieve only the first file .How is it possible .Any help will be appreciated.

What I have tried:

string[] Templateexcelfile = Directory.GetFiles("D:\\Excels");



This retreives all the files in the folder.
Posted
Updated 14-Jul-17 0:09am

1 solution

string Templateexcelfile = Directory.GetFiles("D:\\Excels").FirstOrDefault();
 
Share this answer
 
Comments
Afzaal Ahmad Zeeshan 14-Jul-17 6:32am    
5ed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900