Solved

# Count files in directory in windows phone 8

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

LVL 75

Accepted Solution

käµfm³d   👽 earned 500 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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Progress