Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7572387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:54:48+00:00 2026-05-30T15:54:48+00:00

I have the following code: List<String> suma = new List<String>(); if (File.Exists(Application.StartupPath + /totalsold

  • 0

I have the following code:

List<String> suma = new List<String>();
if (File.Exists(Application.StartupPath + "/totalsold" + username))
     suma = new List<String>(File.ReadAllLines(Application.StartupPath + "/totalsold" + username));
List<String> actual = new List<String>();
if (File.Exists(Application.StartupPath + "/totalsold" + username))
   actual = new List<String>(File.ReadAllLines(Application.StartupPath + "/soldproducts" + username));
List<String> sumatotal = new List<String>();
if (File.Exists(Application.StartupPath + "/totalsoldadmin"))
    sumatotal = new List<String>(File.ReadAllLines(Application.StartupPath + "/totalsoldadmin"));      
 StreamWriter vanzare = new StreamWriter(Application.StartupPath + "/soldproducts" + username);
 StreamWriter total = new StreamWriter(Application.StartupPath + "/totalsold" + username);
 StreamWriter totall = new StreamWriter(Application.StartupPath + "/totalsoldadmin");   

Why the files vanzare,total and totall are not created after the code below is executed ?

 vanzare.WriteLine("Hello World");
 total.WriteLine("Helle World again!");
 totall.WriteLine("Hello World again and again!");

Problem solved!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:54:50+00:00Added an answer on May 30, 2026 at 3:54 pm

    Do you close the file? Writes to files may not immediately occur, since probably both .NET and the OS are caching and thus delaying writes. The file should appear immediately when you open the StreamWriter, though.

    For short-term usage of a file (e.g. for writing stuff and then closing it) you should definitely use the using statement:

    using (StreamWriter vanzare = new StreamWriter(...)) {
       vanzare.WriteLine("Hello World");
    }
    

    which will make sure to properly close the file immediately afterwards and not leave any unmanaged resources around longer than they are needed.

    If you need to leave the file open for longer than a single method, then of course you have to do that manually. Make sure that when you no longer need the StreamWriter (and other IDisposables) you call the Dispose() method on them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: List<string> result = new List<string>(); foreach (string file in
I have the following code: // Form the continuities list string[] continuities = new
I have the following code snippet: Dictionary<int, List<string>> likeListDict = new Dictionary<int, List<string>>(); List<string>
I have the following code: var items = new List<string> {1, 2, 3}; //
I have following code snippet in c#. var list = new List<string> { a,
I have the following piece of code List<String> l = new List<String>(); String s
Let's say I have following code: List<string> numbers = new List<string> { 1, 2
i have the following code: public static void Serialize() { List<string> dirs = FileHelper.GetFilesRecursive(fileDirectoryPath);
I have the following code: List<T> list = new List<T>(); IEnumerable<T> query1 = ...
I have the following code: List<HtmlMeta> metas = new List<HtmlMeta>(); foreach (Control c in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.