C# – How to initialize an array

Array is a fixed size collection of variables representing the same type. Array can store both built-in primitive types (like integer) and custom objects. In this article we’ll present different ways of initializing such arrays. Array of integers Let’s consider an array of integers. Below are presented five different methods of creating 3 elements array, … Continue reading C# – How to initialize an array

C# – How to generate random password

This article delivers proposal of algorithm to generate random passwords or actually random strings which are generated in safe manner and can be used as passwords, discount codes etc. Also, it is configurable, so that you can easily define expected length of string, pool of available characters or minimal number of occurrences of particular elements. … Continue reading C# – How to generate random password

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

.NET Framework upgrade

How to upgrade .NET Framework? First of all you need to install desired framework version on both development and client machines. Development machine is an environment where you code and build your project. It requires .NET Framework Developer Pack. Client machine is an environment where your application is used. It requires lighter package .NET Framework … Continue reading .NET Framework upgrade