How does the "Using" directive find Nuget packages?

Asked

Viewed 19 times

-1

Hello, I’m beginner in programming, I’m using. NET and after installing a package by Nuget did not understand how the Using directive finds the package I want, as well as its classes.

I don’t know if I understand this but Nuget installs the files themselves in some PC directory and not in the directory of my project right? If so, how is it referenced that I want to use the . Cs files from that particular directory where my package is? And if I send my project elsewhere it will not go with the necessary dependencies?

  • Please Edit the Question to limit it to a specific problem with enough Detail to identify an adequate Answer.

  • using does not "find", but rather simplifies the namespace. Imagine you installed a package that the class has Pacote.AlgumaCoisa.NomeDaClasse. This is already available in your project, and to use can do something like var nomeDaVariavel = new Pacote.AlgumaCoisa.NomeDaClasse() to avoid these long names (the namespace may even be long), we use the using Pacote.AlgumaCoisa; and when you need to use just do var nomeDaVariavel = new NomeDaClasse() because the namespace has already been referenced in using, to facilitate the reading of the code

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.