TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
C B
NA
22
22.1k
IEnumerable 'ListItem' get the Sub Folders
Jul 11 2011 5:17 PM
Hello
How do you get all the sub directories? The code works fine if you do not include
(fileExt, SearchOption.AllDirectories).
As soon as you include
(fileExt, SearchOption.AllDirectories)
it returns nothing. it does not through any exceptions i.e. I have put the code in an error handler, 'try/catch'.
string
fileExt = cboFileType.SelectedValue.ToString();//I have been using .jpg from a combo box
IEnumerable
<
ListItem
> q =
from
i
in
new
System.IO.
DirectoryInfo
(SearchDir).GetFiles()
//(fileExt, SearchOption.AllDirectories)
where
i.Name.Contains(fileExt)
select
new
ListItem
(i.Name, i.LastAccessTime);//
this.DataContext = q.ToList();
Note:
I have not included all the code i.e. the code for 'i.Name, i.LastAccessTime'. Hopefully this will clear up confusion for other newbies like me.
Thanks for your time.
Reply
Answers (
2
)
C#.net error message
Serial Port Communications Help