© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•12mo ago•
12 replies
Faker

✅ using keyword as a directive

Hello guys, I'm a bit confused of how the
using
using
keyword is used with a namespace. Say I created a new project. At the root of that project we have a solution and inside that solution we have our project folder. Now, the namespace refers to the individual project folder we have?

Consider the picture for example. The namespace is the same for every .cs file in a particular project? Why can't we do
using LibraryManagement.BankAccount
using LibraryManagement.BankAccount
? What I'm trying to say is, look inside the LibraryManagementFolder and import the BankAccount class but this is incorrect to interpret it like that?

Second thing, consider the following code:

namespace LibraryManagement;

public class BankAccount
{
    public string Number { get; }
    public string Owner { get; set; }
    public decimal Balance { get; }
    
    public BankAccount(string name, decimal initialBalance)
    {
        Owner = name;
        Balance = initialBalance;
    }

    public void MakeDeposit(decimal amount, DateTime date, string note)
    {
        
    }

    public void MakeWithdrawal(decimal amount, DateTime date, string note)
    {
        
    }
}
namespace LibraryManagement;

public class BankAccount
{
    public string Number { get; }
    public string Owner { get; set; }
    public decimal Balance { get; }
    
    public BankAccount(string name, decimal initialBalance)
    {
        Owner = name;
        Balance = initialBalance;
    }

    public void MakeDeposit(decimal amount, DateTime date, string note)
    {
        
    }

    public void MakeWithdrawal(decimal amount, DateTime date, string note)
    {
        
    }
}


When we don't use top-level statement, the namespace should explicitly been set? What the difference between a
namespace
namespace
and the
using
using
keyword directive here please
36D41A2E-0C7B-4D5D-8F21-C8A53656BF01.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ As Keyword
C#CC# / help
4y ago
✅ Quick - Unity "using" directive
C#CC# / help
3y ago
IDisposable and using keyword?
C#CC# / help
2y ago
Hot Reload Error "The using directive for 'System' appeared previously as global using"
C#CC# / help
7mo ago