C# – How to get unique items from list

The easiest way of getting unique items from list is LINQ’s Distinct() method. In this article you’ll see how to use it with both built-in types (like collection of integers) and custom types (like collection of complex type objects). Get unique values from collection of integers Let’s start with creating example list of items where … Continue reading C# – How to get unique items from list

C# – How to check if string contains only digits

There are plenty of methods to achieve this but even though it’s simple task you need to specify requirements like: are white spaces allowed? how to treat empty string? what’s the maximum length of the string? In this article I want to describe 3 different ideas how to solve this problem. Custom function Let’s say … Continue reading C# – How to check if string contains only digits