Hello Devz, JSON files are really common, we can see them everywhere. They provide a good structure to organize data, are simpler and lighter than XML files, and still human readable. In this simple example, we will show you how to use the Json.NET library (Newtonsoft) from NuGet. It is pretty simple to serialize and […]
C# – Natural Comparer
We all had the issue with an OrderBy on a collection of String, having that kind of result: Test1 Test10 Test2 Test20 Test3 Instead of: Test1 Test2 Test3 Test10 Test20 Here is the solution: public class NaturalComparer : Comparer<string> { public override int Compare(string x, string y) { if (x == y) return 0; string[] […]
C# – DistinctBy extension
Hello devz, The Distinct extension from System.Linq is really useful but the DistinctBy a property is missing. So we will create our own DistinctBy extension. No worries, it’s really easy. What is DistinctBy? DistinctBy is a very simple extension snippet for C# which allows the developer to remove duplicated objects in a collection based on […]