I suggest you...

Writing to a file with using

It can't even find the damn file.

Instructions:

Write to the local file Actors.txt

Create a file stream called file with a using statement.
Create a stream writer called writer using the file stram. This block must not use block syntax { ... } and instead by nested as the single statement under the previous using.
Write each item in the list actors to the file on a new line. Use a foreach loop for this.

Code:

using (var file = new FileStream(@".\Actors.txt", FileMode.Open));

Error: Run-time exception (line -1): Could not find file 'C:\Resources\directory\ad7365bd64d5400298d02c7e04ef408c.DotNetFiddle.Web.LocalResources\Sandbox\42654742-f66b-4dad-a6ce-ccee853fa647\Actors.txt'.

How the hell can it not find the damn file? You can't even get through step one, how can you finish the rest of the problem.

1 vote
vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Anonymous shared this idea  ·   ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Anonymous commented  · 

        It says to CREATE not open... try FileMode.Create
        using (var file = new FileStream(@".\Actors.txt", FileMode.Create))
        {
        }

      Feedback and Knowledge Base