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 8691671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:10:01+00:00 2026-06-13T00:10:01+00:00

I am working on an issue I do not remember ever having before. I

  • 0

I am working on an issue I do not remember ever having before.
I am using VS2012 C#

When i add using System.IO; to my main program everything works fine, however when I add it to my class file it will not let me use all of the methods.

using System;
using System.Collections.Generic;
using System.IO;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace FoxySearch
{    
    class FoxySearch
    {
         File.    <<<<----- here i want to add File.Exists("Blablalba")
    }
}

For some reason it wont let me add it. As soon as I add the period the intellisense closes and shows no options.When I then type it out myself it shows red and says,

System.IO.File.Exists(string) is a method but is used like a type

  • 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-13T00:10:02+00:00Added an answer on June 13, 2026 at 12:10 am

    You haven’t really given enough code to say for sure, but it sounds like you’re probably trying to write “normal code” directly in a class declaration, instead of in a method or property declaration.

    Classes can only include declarations – method declarations, field declarations etc. You can’t write:

    class Foo
    {
        int i = 10; 
        Console.WriteLine(i);
    }
    

    etc. The first line is valid as it’s a variable declaration – the second isn’t, as it’s just a method call. If you move the code into a method, then it’s fine:

    class Foo
    {
        public void Bar()
        {
            int i = 10; 
            Console.WriteLine(i);
        }
    }
    

    Additionally, I’d suggest that you revisit your naming – using the same name for a class and a namespace is a bad idea.

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

Sidebar

Related Questions

I am having an issue with implicit conversions not working under certain circumstances (higher
jquery-loadmask not working properly in IE8 I got a same problem. It was issue
I am facing a strange issue.It is working well with outlook 2K3 but not
I am having issues with javascript functionality not working in the admin area. When
I am having issues with overflow: hidden not working in my case. I have
I'm having issues with event.preventDefault() in firefox, it is not working. This is the
Diagonal move not working and issue on left-longPress/right simultaneous But on double keypress the
I have some issues with a PHP file that is not working properly. The
I have an issue working with Microsoft.Build.BuildEngine which supposed to get fixed modifing my
I got some issue working with UINavigationalControllers for iPad. Issue : UINavigationController1 UINavigationController2 Placed

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.