Not sure how to phrase this question, but here is the problem.
I have a namespace designed: my.foo.bar
In one of my classes, I accidentally named the namespace my.foo.Bar
I want to fix the namespace capitalization so that everyone is on the same page, but this is a shared library, and I can’t afford to recompile all programs using this.
So, is there something I can create that, in essence, redirects my.foo.Bar to my.foo.bar?
Not globally. You can use namespace aliases, but only in the client code. It sounds like you might need to take a breaking change.
One way of doing it, if it is only one or two classes, would be to copy them from
my.foo.Bartomy.foo.bar, deprecate the ones in the bad namespace using the Obsolete attribute, and slowly move clients over to the correct ones.If the class is stateless, then the class in the
my.foo.Barnamespace could delegate to the one in themy.foo.barnamespace as @JohnSaunders suggests, but only if client’s usage of that class doesn’t preclude delegation (everything is a method or a property, that class’s Type isn’t used via reflection, etc).