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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:18:00+00:00 2026-05-13T11:18:00+00:00

I sorta feel embarrassed because I am sure the answer to this is simple.

  • 0

I sorta feel embarrassed because I am sure the answer to this is simple. Just to add some background, I am a full time java developer with a bachelors degree and 2 years of experience. I just started C# today using Visual Studio 2010 and Google to fill in the differences between C# and java.

So I had a console application that runs all good. All the code was in the main method, because I was trying to learn syntax and make sure things were working before I got too complicated.

I went to move all the code out of the main method and into its own class.

The main method and the class have the same namespace, but defined in separate files.
One called Program.cs, the other called FileCache.cs.

FileCache.cs:

namespace SyncServer {
    public class FileCache {

        public FileCache() {
             //...code and such
        }

       //...methods and such
     }  
}

Program.cs:

namespace SyncServer {
    class Program {

        static void Main(string[] args) { 
            FileCache fileCache = new FileCache(); //major jitterbugs;
        }
    }
}

The type or namespace name ‘FileCache’ could not be found (are you missing a using directive or an assembly reference?)

I get no other compile errors or warnings. Also, if I move the FileCache definition into Program.cs, it compiles fine. I was hoping to find a solution where I didn’t have to put ever class in the same file. 🙂

Thanks in advance!

  • 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-13T11:18:01+00:00Added an answer on May 13, 2026 at 11:18 am

    Try this:

    • Move your FileCache code back into your program.cs file
    • Delete the FileCache.cs source file
    • Right click the project in the Solution Explorer, choose Add->Class
      Note: If you don’t see the Add sub-menu with a Class option, you aren’t right clicking in the right place.
    • Name the new file FileCache.cs
    • Paste your code back in, cleanup as necessary
    • Cross ’em if ya got ’em and try giving it a compile

    Deeper Note: The reason for going through this song and dance is to ensure that the “Project” knows about your source file and can compile/link/whatever it as necessary.

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

Sidebar

Related Questions

I feel sure this is a simple answer but as a rookie I'm failing
I feel like this is a stupid question because it seems like common sense
I have a python question that I'm sure is pretty simple - please feel
I'm sorta at a loss to why this doesn't work considering I got it
This question might belong on one of the other trilogies, but it sorta seemed
I originally started this question in another thread, but that thread was sorta, kinda
I feel like the answer will be a oh, THAT button, duh sort of
I feel, every time I read a C or C++ program, that half or
This is my first post on stackoverflow, so feel free let me know if
I really have no idea what to title this so someone PLEASE feel free

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.