silverlight 4.0 - How to fix exception MethodAccessException during file reading? -


Read

I have a text file which is added to your project DataMid / Bigram_MidWord.txt where DataMid a folder and Bigram_MidWord.txt There is a file to read

FileStream Filestream = write new FileStream (@ "/ Sourcecode, component / DataMid / Bigram_MidWord.txt", FileMode.Open, FileAccess.ReadWrite) p>

I Exception and get this:
try to use the method failed: System.IO.FileStream..ctor (System.String, System.IO.FileMode, System.IO.FileAccess) < / P>

How can I fix this problem?

problem Trying to use FileStream . FileStream file is used to access the system (such as luggage isolated)

A resource is a text file that your XAP file, you have the following code You can use:.

  string text; Uri uri = new Uri ( "(" / AssembyName; component / DataMid / Bigram_MidWord.txt ", UriKind.RelativeOrAbsolute); StreamResourceInfo Mr = App.GetResourceStream (URI); StreamReader sr = new StreamReader (sri.Stream); text = sr .ReadToEnd (); sr.Close ();    

Comments