Sometimes I worry about software development or I look for solutions to C# problems. If I come up with anything useful, I’ll post it here.
Cache data in memory and update it regularly via a background service (.NET Core MinimalAPI example)
Suppose we have a backend that takes a long time to collect and return the necessary data. Then it would make sense for the backend to cache the data so that it doesn’t always have to recalculate it. There are mature solutions for this (see for example Caching in .NET), but I have made my own small example here anyway, for the following reasons: I want the data to be generated in the background and the business code should be as decoupled as possible from the rest. Secondly an immediate update of the data should be possible. And last but not least I wanted to implement my own small minimal API example.
Serialization and deserialization of polymorphic objects with System.Text.Json and .NET 7
Six months ago, I described how to serialize and deserialize polymorphic objects using System.Text.Json in .NET 6. This was a bit complicated in .NET 6. In .NET 7 it has improved significantly and is now quite simple.
Drawing spirograph curves (also called hypotrochoids) with C# turtle graphics
A while back I owned a Spirograph Set that could be used to draw figures like the example above. Mathematicians also call such curves Hypotrochoids. In last post we drew polygons and stars with turtle graphics, now we draw spirograph curves. We use some more advanced Woopec features (transparent filling, individual shapes and synchronized turtles).
Drawing polygons and stars with C# turtle graphics (and GCD calculation)
Suppose you have a fixed number of vertices. How can you connect them to a regular polygon or a star? Here we need some math: prime factorization and GCD (Greatest Common Divisor). And with Woopec C# Turtle Graphics we can then calculate and draw that.
IPC with polymorphic objects and System.Text.Json Serialization
The task: I have two processes. Process
Acreates graphical objects, process
Bdisplays these objects on the screen. To do this, the objects must be transferred from
B. The tools for this are quickly found: The objects can be serialized to a string with
Aand deserialized in process
B. Anonymous pipes can be used to transfer the strings from
B. The difficulties lie in the details…
Woopec release 1.0.0
As of today, the first version of the Woopec library is available on NuGet.
Turtle graphics for C#?
C # is a great programming language with endless possibilities.
There are great introductory pages for C# beginners - for example Learn to code C#. But getting started with graphics programming is not easy.
subscribe via RSS