Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I need global:: here?

I have run into ...I don't think I would call it a problem as much as I would a quirk. It confuses and confounds me.

I am adding Ninject to my site. It works fine. No questions about troubleshooting Ninject specifically, but I encountered this when setting up my modules...

Here is my SessionModule.cs file.

namespace Lightcast.Web.Mvc.Injection.Modules {
    public class SessionModule : Ninject.Modules.NinjectModule {

        public override void Load() {
        }
    }
}

Also shown in this screenshot.

SessionModule.cs

I get the error

Unknown type 'Modules' of Lightcast.Web.Mvc.Injection.Ninject

Now if I change it to this ...

SessionModule.cs(2)

It works just fine. So obviously there is a namespace collision. What I do not understand is why? I have never encountered this before. It just seems like the absolute oddest thing to me.

like image 528
Ciel Avatar asked Feb 01 '26 11:02

Ciel


1 Answers

The reason seems to be that somewhere in your project a namespace or type named Lightcast.Web.Mvc.Injection.Ninject exists that hides the global NInject namespace.

like image 52
Florian Greinacher Avatar answered Feb 03 '26 07:02

Florian Greinacher



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!