Go Premium for a chance to win a PS4. Enter to Win

x
Solved

# Count files in directory in windows phone 8

Posted on 2014-01-10
Medium Priority
260 Views
I need linq snippet for count files in directory.
0
Question by:amatic
• 2
• 2

LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 total points
ID: 39770866
Based on what I see in the documentation, you should be able to use either the Directory class or DirectoryInfo class to determine this.

e.g.

DirectoryInfo dir = new DirectoryInfo(@"path\to\folder");
int fileCount = dir.GetFiles().Length;

// OR

fileCount = Directory.GetFiles(@"path\to\folder").Length;


There's no perceived benefit from using LINQ to get this information as you'd have to involve these classes anyway.
0

Author Comment

ID: 39770870
Are you sure that will working on Windows Phone???
0

Author Comment

ID: 39770873
How to get directory path on Windows Phone??
0

LVL 75

Expert Comment

ID: 39770879
I have to confess that I haven't (yet) written anything for Windows Phone, so I can only go by the documentation:

0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Integration Management Part 2
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
###### Suggested Courses
Course of the Month7 days, 8 hours left to enroll