I have a generated code file that creates a class and doesn't give it a namespace. Because the code is generated and updated some times I don't want to add any additional code there.
using System;
public class Apartment { ... }
I also have the Apartment class in a namespace (in different dll).
using System;
namespace My.Core.Entities {
public class Apartment { ... }
}
Now, I try to use the former one in a unit test (that references to both dlls). I have tried following code to ignore the global class.
using System;
using Apartment = Core.Entities.Apartment;
using GlobApartment = global::Apartment
public class Tests {
private List<Apartment> _apartments = new List<Apartment>();
}
It gives the error Namespace '<global namespace>' contains a definition conflicting with alias 'Apartment'
I understand why the error happens. The question is if there is any way to ignore the global::Apartment some way in this file (I tried the using GlobApartment
thing)? I wouldn't like to change all Apartment to My.Core.Entities.Apartment. Is there any way to use the single term Apartment
in the code?