I have an image in a C# WPF app whose build action is set to \'Resource\'. It\'s just a file in the source directory, it hasn\'t been added to the app\'s resource collection
There's no need to call the Close() method, it will be automatically called by Dispose() at the end of the using clause. So your code might look like this:
using(BinaryReader reader = new BinaryReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ResourceBlenderExpress.Resources.images.flags.tr.png")))
using(BinaryWriter writer = new BinaryWriter(File.OpenWrite(imageFile)))
{
while((read = reader.Read(buffer, 0, buffer.Length)) > 0)
{
writer.Write(buffer, 0, read);
}
}