views:

201

answers:

2

Hello,

As I love to develop file I/O applications and my new development platform is Windows Mobile. Is there any way to read all the file, without using File.ReadAllText? Because Windows Mobile don't have this function.

+3  A: 

Write your own:

static string ReadAllText(string path) {
    using (var r = new StreamReader(path)) {
        return r.ReadToEnd();
    }
}
Frank Krueger
Thanks very much, I'm going to build a library of this, to use in future projects.
Nathan Campos
Good, I highly recommend building up a personal "augment library" that fixes missing bits from the BCL. But it's also important to learn the IO library in and out - saves a lot of time.
Frank Krueger
To keep its size down, the BCL omits methods that are just short-cuts, like File.ReadAllText, where is simple enough to write your own version.
ShellShock
A: 

A lot of the file operations are supported by the mobile framework, for example:

string text;
using (StreamReader reader = File.OpenText(fileName)) {
   text = reader.ReadToEnd();
}
Guffa