Importing code and NuGet packages
In the last chapter, we saw how code cells can be used to define variables, classes, and methods. These features are fantastic when you need to write small pieces of code to accomplish some goal.
However, it can be helpful to store code outside of notebooks and import it in when needed. This keeps the details of the code outside of your notebook and allows the notebook to focus on the task that it is trying to accomplish, instead of the supporting code. This is particularly useful when working with code that’s been written elsewhere.
In this section, we’ll cover importing individual files, projects and assemblies, and NuGet packages.
Importing code files
If you have a C#, F#, HTML, JavaScript, PowerShell, or other type of supported code file, you can import that code into your notebook using the #!import
magic command.
#!import
works by taking in a relative or absolute path to a supported code file and effectively injecting...