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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:16:05+00:00 2026-05-10T20:16:05+00:00

How is it possible that .NET is finding the wrong MyType in this scenario?

  • 0

How is it possible that .NET is finding the wrong MyType in this scenario?

I have a type A.B.C.D.MyType in a project that I’m working on, and I’m referencing a DLL that has a type A.B.MyType. I do not have any using A.B; statements anywhere in my code, and I do have using A.B.C.D;. When I compile, the compiler thinks any naked reference to MyType means A.B.MyType.

I know I could just rename the class or use an alias, but I’m wondering how this is even possible. Any ideas?

  • 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. 2026-05-10T20:16:06+00:00Added an answer on May 10, 2026 at 8:16 pm

    Are you working in a namespace that is under A.B namespace? (for example A.B.X) if so the C# namespace resolutions (ECMA-334 C# Language Specification : 10.8 10.8 Namespace and type names) says:

    … for each namespace N, starting with the namespace in which the namespace-or-typename occurs, continuing with each enclosing namespace (if any), and ending with the global namespace, the following steps are evaluated until an entity is located…

    and then followed by:

    If K is zero and the namespace declaration contains an extern-alias-directive or using-aliasdirective that associates the name I with an imported namespace or type, then the namespace-or-type-name refers to that namespace or type

    This means that name resolution starts at the current namespace and searches all namespaces up to the root, and only after this hierarchical search ends, then the namespaces imported with the using clause are searched.

    The following example prints ‘Ns1.Foo’

    using Ns1.Foo.Foo2;  namespace Ns1.Foo {     class Foo     {         public void Print()         {             System.Console.WriteLine('Ns1.Foo');         }     } }  namespace Ns1.Foo.Foo2 {     class Foo     {         public void Print()         {             System.Console.WriteLine('Ns1.Foo.Foo2');         }     } }  namespace Ns1.Foo.Bar {     class Bar     {         public void Print()         {             new Foo().Print();         }          static void Main()         {             new Bar().Print();         }     } } 

    Edit: Adding a using clause inside a namespace, will make so that the namespace is searched before the hierarchical search of current namespace is done is done. Change the example to:

    namespace Ns1.Foo.Bar {     using Ns1.Foo.Foo2;     class Bar     {         public void Print()         {             new Foo().Print();         }          static void Main()         {             new Bar().Print();         }     } } 

    and Ns1.Foo.Foo2 will be printed.

    Edit: changed example

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

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • 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 Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I'm a former classic ASP programmer and sometimes PHP programmer writing my first ASP.NET
I've just been informed at my workplace that we have an application that is
First, the problem: I have several free projects, and as any software they contains
I'm looking for a way to edit a configuration file (web.config in an asp.net

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.