No, you can't. This is because C# and .NET is not like Java, TypeScript and other languages where the concept of namespaces, packages and libraries are combined - in .NET they're entirely separate: multiple packages can include the same library DLL file, and multiple library DLLs can contribute towards shared and different namespaces.
For example, the System
namespace has its members in mscorlib.dll
, System.dll
, System.Core.dll
, and others. None of these assemblies belong to any particular package as they're part of the BCL in your CLR implementation. Furthermore, anyone is free to declare their own types in namespace System
.
With respect to "packages": the CLR is completely unaware of them: they're a design-time concern; instead all it cares about is what DLL files to link. You don't have to use NuGet packages at all (.NET developers survived just fine for the first 13 years without a built-in package manager).
Note that NuGet allows you to have multiple DLL files a single package, and the package author does not need to "own" (legally or otherwise) the DLLs contained within either, which means multiple NuGet packages can share the same assembly DLL, and those DLLs could share namespaces.
I take issue with these words of yours:
I am including some dependencies:
Remember, C# is not TypeScript - despite syntactic similarities (like C compared to C++) they're very different - it isn't appropriate to refer to namespace imports as "including dependencies" - it's just syntax - whereas in TypeScript the statement import { Foo } from './bar'
is more than just syntax as it will invoke the runtime platform's package/module import system, whereas using
in C# is an entirely inert statement that simply saves you from typing global::The.Full.Namespace.Name
every time you use an identifier.