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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:07:06+00:00 2026-06-11T14:07:06+00:00

When adding a new class into a namespace this is what I get (this

  • 0

When adding a new class into a namespace this is what I get (this is in an mvc3 project)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Foo.Models
{
 public class Bar
 {
 }
}

In the namespace Foo.Models there are other classes. However, it is nice to separate content by placing them in different .cs locations. I think that is fairly standard. I know the compiler works its magic to compose all these later anyway. Which is kind of where my question arose from. If the namespace is composed later on, then why is there a requirement to always be redefining what the class is using? If it is already available somewhere in the namespace, then should it be necessary to say using System; in every .cs file defining a class inside of the namespace? Can someone explain this a little for me, and also perhaps shed some light on a possible way to do implement this in a way where I define all of the using cases for a namespace once and then any classes added to that namespace inherently have access to those.

  • 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-11T14:07:07+00:00Added an answer on June 11, 2026 at 2:07 pm

    The using statements are scoped to the particular .cs file you are working with.

    They simply provide a convenient shortcut in the context of that class file that allows you to use the names of classes only, rather than fully qualifying class names everywhere you use them.

    Namespaces exist because different teams will inevitably use the same class name for different classes (I wonder how many Util classes are out there).

    You may have two different classes in your project that want to use different objects with the same name. The ability to have different using statements in each file lets you do that conveniently.

    Note that you can always edit the template for new classes to pre-populate the using statements you need in all of your classes.

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

Sidebar

Related Questions

In VS2008, I am adding new classes to a web project. When I right-click
Will adding new member function into d pointer class definition break binary compatibility? For
I want to remove a css class before adding a new class to an
This is a class assignment to do ordered insertion into a sorted linked list.
I've thrown myself headfirst into C# and .Net 2.0 using Linq, and I'm having
When I go into xcode try to add a new class with File>New>New File
I run into an InvalidOperationException when attempting to run this code. Example Code using
While working on a project today I ran into this odd behavior in .NET.
How do I adding new aloha-button in aloha-multisplit-expanded box. (I want the ability to
I have trouble with adding new row to my UITableView. I read similar questions

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.