Local development
To run the code for your challenge locally, you’ll needdotnet installed. Our test runners use Dotnet 8.0 (as of April 2024).
The script for your challenge (like ./your_sqlite3.sh) will automatically compile your code using dotnet before executing it. It’ll
look something like this:
File structure
- The files for your solution are placed in the
src/directory. src/Program.cscontains themainfunction, which is what the test runner executes.- The
.csprojfile defines project settings, target frameworks and dependencies.
Adding more files
You can add more files and directories tosrc/. The test runner will include them when compiling your code.
For example, if you added a file at src/Foo.cs, you could use it like so:
src/ belong to the same namespace. This namespace is called the project namespace. E.g. If the project name is MyProject, all classes are defined under the MyProject namespace. This is why you can call foo() without importing anything.
If you want to define a class under a different namespace, you’ll need to use the namespace keyword like this:
Foo class in Foo.cs under the AnotherNamespace namespace.
Adding dependencies
You can add dependencies to your project by usingdotnet.
For example, to add the Newtonsoft.Json package, run the following command in your terminal:
.csproj file with the package reference: