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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:13:09+00:00 2026-05-13T06:13:09+00:00

I was cleaning up a Visual Basic (.NET 2.0) solution. Splitting it into two

  • 0

I was cleaning up a Visual Basic (.NET 2.0) solution. Splitting it into two projects.
150 classes have the Namespace RebateCalculator at the top of the file.
These files are now sitting in Project with the default namespace RebateCalculator. If I were to insert a Class1.cs file and then namespace declaration that all my other files have – then the fully-qualified class name would be RebateCalculator.RebateCalculator.Class1

Is there something I can stick on the front of the Namespace declaration to make it absolute? instead of repeating itself? I’d rather find this kind of solution versus removing the namespace declaration (in case the files get moved again)

End Goal: to be able to do a search/replace on ‘Namespace RebateCalculator’ to fix the issue in 150 files.

  • 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-13T06:13:09+00:00Added an answer on May 13, 2026 at 6:13 am

    The duplicate answer you posted alluded to the problem.

    VB.Net has the concept of a “Root Namespace”. When you add a Namespace statement to the code file, the name given is combined with the root namespace to form the full namespace.

    So, in VB.Net, if your root namespace is MyRoot and then you create a class and surround with a namespace of MyNamespace, then the full class name is MyRoot.MyNamespace.ClassName. If you don’t use a Namespace statement, then the full class name is MyRoot.ClassName. In other words, the root namespace setting contributes to the name of the namespace.

    In C#, this is not the case. C# has a “default namespace”. This is simply a namespace definition that is automatically added to new classes when you create them. If you remove the namespace declaration, then the class has no namespace. In other words, the default namespace setting does not actually contribute to the name of the namespace.

    In C#, whatever is on the namespace declaration is the namespace used. The default namespace setting only determines what is inserted by default in the code file.

    Take this VB program that has a Root Namespace setting of “TestVBConsole” and no namespace statement in the class:

    Module Module1
        Sub Main()
            Dim tc As New TestClass
    
            Console.WriteLine(tc.GetType().FullName)
    
        End Sub
    End Module
    

    and this class

    Public Class TestClass
        Public aField As String = "Default"
    End Class
    

    The output is

    TestVBConsole.TestClass
    

    The same program in C# outputs

    TestClass
    

    As to your question, I don’t think there is any way to override that behavior. You just have to remember in C#, to make sure your namespace declarations are correct.

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

Sidebar

Ask A Question

Stats

  • Questions 386k
  • Answers 386k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The places I'd check are: File modification times (to see… May 14, 2026 at 11:51 pm
  • Editorial Team
    Editorial Team added an answer goto :foo2 :foo sleep 1 :foo2 del file if exist… May 14, 2026 at 11:51 pm
  • Editorial Team
    Editorial Team added an answer I eneded up going this route: The HTML code <script… May 14, 2026 at 11:51 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.