In this code snippet, we’ll find out what the unchecked keyword does in C#. The unchecked keyword is used to suppress arithmetic overflow exceptions. We will try to add two integers whose sum will exceed the size of the integer data type. This will cause an overflow to occur. The overflow would normally throw an exception, but if we wrap the expression with unchecked the exception will get suppressed and the integer will just overflow.
This post contains a collection of C# related things I learned and projects I did. The C# Code Snippets section is where you can find C# and .NET related topics like decision statements, Object-Oriented programming in C#, Threading, Events, Collections, … Meanwhile, under Algorithms and useful bits of code you will be able to find such things as sorting algorithms, quick how-tos, and other useful bits of code that don’t really fit anywhere else. And finally, there is the C# Project section that has my C# projects.
In this code snippet, we will learn how to use the if, else if and switch decision statements in C#.
In this code snippet, we’ll make a struct in C#. A struct is like a lightweight class. You would use a struct for making a small object that doesn’t have a lot of members. If your struct grows too big(has too many properties/methods) you should make a class instead.
In this code snippet, we’ll take a look at the sealed keyword in C#.
In the following example, we will make a sealed class and a sealed method. Then we’ll try inheriting from the sealed class and overriding the sealed method. As you will be able to see we’ll get an error as sealed methods can’t be overridden and sealed classes can’t be inherited from.
This is a tutorial for looping through 1D, 2D and 3D arrays in C#.
This tutorial covers the deployment of a simple UWP app onto a Raspberry Pi 3 running Windows 10 IOT.