Android : Xamarin StreamWriter

on Wednesday, April 1, 2015


Could you hep me with a doubt I have?


I have an embedded resource text file, and when I try to use a streamWriter to write on it, I get this error: "A System.ArgumentException was thrown. Can not write to stream."


This is the code:



var assembly = Assembly.GetExecutingAssembly();
var resourceName = "SuperMimo2.Products.txt";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamWriter writer = new StreamWriter(stream))
{
writer.WriteLine(txtLines.Text);
}


Could you tell me what can I do?


Thanks for the attention!


0 comments:

Post a Comment