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

  • Home
  • SEARCH
  • 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 8477505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:29:10+00:00 2026-06-10T18:29:10+00:00

I am firing up Visual C# (2010 Express) for the first time, and I’ve

  • 0

I am firing up Visual C# (2010 Express) for the first time, and I’ve created a new project for a WindowsFormsApplication. No code has been written yet, but I created a button and placed it on Form1. Then, I double-clicked the button and am taken to the part of the code where you write what happens when the button is push/clicked.

The first thing I would like to do is read data from a LARGE tab-delimited text file (30MB). The text file contains 7 structured columns of data like names, age, favorite color, animal, etc. Nothing tricky or fancy in the text formatting. I’m using the code below:

File.ReadLines(sourceFilePath)
.Select(line => line.Split('\t'))
.ToArray();

But my more basic question is how do I establish and define File and sourceFilePath? With the code above I get “The name ‘File’ does not exist in the current context.

  • 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-06-10T18:29:12+00:00Added an answer on June 10, 2026 at 6:29 pm

    You need to add the following line to the top of your C# file:

    using System.IO;
    

    This will allow the use of the File class, which is in the System.IO namespace.

    As for defining sourceFilePath, that’s just a variable, which you can declare and set to whatever file path you need, e.g.

    string sourceFilePath = @"c:\data\file.csv";
    

    Note the use of @ before the string literal; this prevents the backslashes from being treated as the start of escape sequences. You can instead just escape the bakslashes, e.g.

    string sourceFilePath = "c:\\data\\file.csv";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just moved from Visual Studio Web Express to professional. (2010) I have a
Possible Duplicate: ASP.Net: DropDownList's SelectedIndexChanged event not firing I created a new ASP.NET default
The question dealing with Visual Studio optimizations saved me so much time firing it
Error context: Visual Studio 2010 Service Pack 1 ASP.NET MVC 3 Application IE9 with
I am using Visual Studio TFS 2010 and want to develop an notification application.
Every time I try to compile my code, I get a huge amount of
I'm developing in Visual Studio 2010 and I've just downloaded and installed Script# 0.6.2
Visual Studio has a toolbar button/keyboard shortcut/menu item that comments out selected lines of
I installed IronPython yesterday. After running Visual Studio the IronPython project template showed up
I'm trying to port some Visual C++ (VS2005) code so that it will compile

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.