Author: Marinko Spasojevic

C# Intermediate – Anonymous and Nullable Types

In this article, we are going to talk about anonymous classes, how to create them, and why they are useful. Moreover, we are going to talk about nullable types and how to use them with the value types and what properties we have with the nullable types. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Anonymous and Nullable Types in C# Source Code.  We are going to divide this article into the following sections: Anonymous Classes Nullable Types Properties of Nullable...

Read More

C# Intermediate – Static Members, Constants and Extension Methods

In this article, we are going to talk about static members in C#, when and why to use them. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Static Members in C# Source Code.  We are going to divide this article into the following sections: About Static Methods Working with a Static Method Creating a Field by Using the Const Keyword Static Class About Extension Methods and How to Use Them Conclusion About Static Methods When we define a method in a...

Read More

C# Intermediate – Properties in C#

A property is a member that provides a flexible tool to read and write the value of a private field. We use them as public data members but actually, they are specific methods called accessors. In this article, we are going to talk more about properties and how to use them in C#. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial. To download the source code, you can visit Properties in C# Source Code.  We are going to divide this article into the following sections: Property Syntax Read-Only and...

Read More

C# Intermediate – Classes and Constructors in C#

The word “class” is the root of the word “classification”. When we create our class we systematically arrange information and behavior into a meaningful entity. We don’t use classification only in the software development, we are doing the same in real-life situations. So as it is important in a real-life, it is important in a software development. The classes are reference data types, and if you want to learn more about data types you can visit our module about C# basics. If you want to see complete navigation of this tutorial, you can do that here C# Intermediate Tutorial....

Read More

C# Back to Basics – Working With Files, File and Directory

File and Directory classes contain different static methods for manipulating the files, directories, and subdirectories. These classes exist in the System.IO namespace. So, let’s inspect some of the most used methods of both classes. For the complete navigation of this series check out: C# Back to Basics. File Methods WriteAllText(string path, string contents) creates a new file and writes content to that file. If the target file already exists, it will overwrite it: C# 123 string path = @"C:\FileExamples\test.txt";string content = "Example content as a string message";File.WriteAllText(path, content); WriteAllLines(string path, string[] contents) creates a new file and writes a...

Read More