Author: Marinko Spasojevic

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

C# Back to Basics – Working With Files, StreamWriter and StreamReader

It’s time to learn how to work with files in C#. For that purpose, in this article, we will cover two classes StreamWriter and StreamReader. For the complete navigation of this series check out: C# Back to Basics. If you want to download the source code for our examples, you can do that from here StreamWriter and StreamReader C# Source Code. The StreamReader and StreamWriter classes enable the reading and writing actions to a file. Both of these classes exist in the System.IO namespace as well as many other classes for working with files and directories. We are going...

Read More

C# Back to Basics – Arrays in C#

We often have a situation where we need to use a couple variables of the same type and to execute the same operation on each of them. Imagine if we need hundreds of variables or even more, well we can agree upon a fact that creating a hundred variables of the same type is not a solution. Fortunately, C# provides us with the complex type named array. For the complete navigation of this series check out: C# Back to Basics. To download the source code, visit Arrays in C# Source Code. Arrays are the reference data types that consist...

Read More