Hello Fellow Fiddlers -
This is @nirajshah and @eric and we are founders at DNF. We are starting an email newsletter to share with you the most interesting fiddles that cover the latest .NET technologies and NuGet packages.
This way you can stay on the bleeding edge of .NET and also have some fun.
50 Shades of Deep Cloning
I had to do some deep-cloning of objects recently. Check out the fiddle with various approaches and performance comparison.
https://dotnetfiddle.net/FfDIiz
Credit to the Stack Overflow article here for much of the code:
https://stackoverflow.com/questions/78536/deep-cloning-objects
System.Text.Json - new way to serialize and deserialize JSON in .NET Core
There is now a baked-in JSON serializer that is included in .NET
Check out how it works and how it compares to good old Newtonsoft.JSON
https://dotnetfiddle.net/31yTy7
Brief comparison is here:
https://schneids.net/comparing-newtonsoft-json-with-system-text-json
And here is more info directly from the horse’s mouth
why we built it, how it works by microsoft
Nuget link: https://www.nuget.org/packages/System.Text.Json/
Tower of Hanoi
Tower of Hanoi is a classic puzzle. You have 3 towers and 3 discs on first tower. The object of the puzzle is to move all 3 discs from first tower to last tower, but you can’t place a larger disc on smaller disk. It may seem a bit simple at first, but go ahead and try it with 3, 4, 5 discs.
You can try it here:
https://www.mathsisfun.com/games/towerofhanoi.html
Try to find the best C# solution, without the internet’s help.
We will have a solution for you in the next newsletter.
Sponsored by:
Integrate Github, Slack, and Jira with Pandaflow
If you hate fun and want to unsubscribe, click on the unsubscribe link at the bottom of the email.
If you want to save a puppy and become a sponsor click here.