c# - How to process multiple files fetched using openFileDialog using Streamreader class? -
How do I read two files that I have faded from the The above code only brings the previous file that I select using Try this: Note: You declared the stream reader object inside the block to myReader As if my code is so that you can remove the openFileDialog box? Below is the code that I have written.
Private Zero LoadBetBetton_click (Object Sender, EventErgus E) {var OpenFileDialog = New OpenFileDialog (); OpenFileDialog.Multiselect = True; XmlSerializer serializer = New XmlSerializer (type (list & lt; ExtractSerializedAction & gt;)); StreamRedder myReader = Faucet; Foreign (openFileDialog.FileNames in string file) {myReader = new streamrider (file); } Var Results = Serializer. As a list of diaryials (& lt; ExtractSerializedAction & gt;; myReader.Close (); Forchach (different items in result) {// some code here}; }
openFileDialog . I know that the problem is with
streamreader logic and
foreach loop but do not know how to solve it?
string (file in the openfileDialog.FileNames } {{StreamReader myReader = new StreamReader (file)) is used as a {var result = serializer.Deserialize (myReader) list & lt; ExtractSerializedAction & gt;; Foreach (results in var items) {// some code here}}}
StreamReader object declaration (the following statement) out of the loop.
StreamReader myReader = null; // Remove it
Comments
Post a Comment