-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 likevar nomeDaVariavel = new Pacote.AlgumaCoisa.NomeDaClasse()
to avoid these long names (the namespace may even be long), we use theusing Pacote.AlgumaCoisa;
and when you need to use just dovar nomeDaVariavel = new NomeDaClasse()
because the namespace has already been referenced inusing
, to facilitate the reading of the code– Ricardo Pontual