Lajos Arpad
Lajos Arpad

Reputation: 77063

Same class name in same namespace

I'm working on a web-project and I was asked to move some files from a project to another project, but both of the projects are in the same solution. So I migrate File1 from project A to project B. However, I have a "Foo" namespace in File1 with a class called "Bar". However, I have a "Foo" namespace in project B too and in the other "Foo" namespace I have another "Bar" class. How can I solve the issue, knowing that renaming a namespace or a class is not an option?

Thank you,

Lajos Árpád.

Upvotes: 0

Views: 1085

Answers (3)

Lajos Arpad
Lajos Arpad

Reputation: 77063

I've managed to solve my problem by giving a default namespace to the B project, so the given namespace generated at the B project was finally inside the default namespace of the project and the namespace which came from the DLL remained outside the default namespace of the project.

Upvotes: 0

M. Mennan Kara
M. Mennan Kara

Reputation: 10222

Simply you have two options:

  1. Rename on of the classes or namespaces
  2. Merge both Bar classes (you can make them both partial, or merge them by moving code from one to another)

Upvotes: 1

competent_tech
competent_tech

Reputation: 44971

You cannot do this. You either need to change the namespace or the class name of either the source or target.

Upvotes: 0

Related Questions