Return to Snippet

Revision: 67052
at August 5, 2014 06:48 by vhdm


Initial Code
private string ReadFile(string filePath)
        {
            //this verse is loaded for the first time so fill it from the text file
            var ResrouceStream = Application.GetResourceStream(new Uri(filePath, UriKind.Relative));
            if (ResrouceStream != null)
            {
                Stream myFileStream = ResrouceStream.Stream;
                if (myFileStream.CanRead)
                {
                    StreamReader myStreamReader = new StreamReader(myFileStream);

                    //read the content here
                    return myStreamReader.ReadToEnd();
                }
            }
            return "NULL";
        }

Initial URL


Initial Description
Note: change build Action of file to resource

Initial Title
read txt file with windows phone

Initial Tags
phone, window, xml

Initial Language
C#