Content and build toolchain for .NET by Example, a site that teaches .NET (C#, F#, VB.NET) via annotated example programs/scripts.
The .NET by Example site is built by extracting code and comments from source files in examples and rendering them using templates into a static public directory. The programs implementing this build process are in tools, along with dependencies specified in the .csproj.
The built public directory can be served by any static content system. The production site uses GitHub Pages, for example - https://alexhedley.github.io/dotnetbyexample/.
Inspired by Go by Example (Source)
A 📂 folder containing a .csx
, .vb
, .fs
(and .bat
with run instructions) file complete with code and code comments is converted to a corresponding .html
file.
Please raise a new 💡Discussion with any ideas for another example, then MRs are welcome :).
- 📂src
cd src
dotnet build --configuration Release
Locally
dotnet run --project src/dotnetbyexample/dotnetbyexample.csproj
src\dotnetbyexample\bin\Release\net9.0\dotnetbyexample.exe
- 📂docs
If you wish to run the examples locally you can use dotnet script
, although see Announcing dotnet run app.cs – A simpler way to start with C# and .NET 10 and I will update the scripts over time.
dotnet script
https://github.com/dotnet-script/dotnet-script
dotnet tool install -g dotnet-script
dotnet tool list -g
dotnet tool uninstall dotnet-script -g