NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Reading Text from a File

The following example reads a string in from an existing text file.

using System;
using System.IO;
public class TextFromFile 
{
    public static void Main(String[] args)
    {
        StreamReader sr = File.OpenText("MyFile.txt");
        String input = sr.ReadLine();
        Console.WriteLine (input);
        sr.Close();
        
    }
}

This code creates a stream reader that points to MyFile.txt through a call to File.OpenText.You can now read a line from the file by calling StreamReader.ReadLine.