namespace SomeNamespace
{
public class Destination { }
}
namespace SomeNamespace.SubNamespace
{
public class Source { }
}
There's no reason to create a using statement for Destination.
Or, another thought is to be very specific with the destination type name with an alias. Maybe do this:
using D = SomeNamespace.Destination;
...
public static D MapToDestination(this Source @this) => new D() ...
That way I'm always creating the right destination type (the source we'll put in its current namespace, and the only collision I could possibly run into is if someone has a class with the name of the extension class with the same method name. Possible, but for now I'll live with that)
If I have this scenario:
There's no reason to create a
using
statement forDestination
.Or, another thought is to be very specific with the destination type name with an alias. Maybe do this:
That way I'm always creating the right destination type (the source we'll put in its current namespace, and the only collision I could possibly run into is if someone has a class with the name of the extension class with the same method name. Possible, but for now I'll live with that)