Keyword readonly and static in C#

Access restriction of a variable in a class is a broad topic in C#; we define the restriction by adding the keyword in front of our variables. In some cases, we may have some member or variables in our class, and we don’t want other objects or classes amend their value. In this case, keyword…

Add a test file to C# project via Command Line Terminal

Unit Test is important in C# development journey. In this post, I am going to talk about how to add a test file via command line terminal in Windows 10 and we compile the project in Visual Studio Code. Start A New Project I start a new project in a directory named TestProject. Type in…

Reflection on Flow Control in C#

In C#, Flow-Control is used regularly.  It determines our program’s logic.   I have encountered some issues while using them, even though the syntax is quite simple.  These issues are not complex, but it can be serious if I ignore them. While in C# The While statement is straight forward, it keeps running till the variable i reaches…

Namespace in C#

Introduction Namespace in C# development is very heavily used regularly; it is helpful when we develop a relatively large or complex project.  For instance, .NET uses namespace to organise its classes. When it comes to using namespace in C#, it allows us to access the class of namespace by using namespace.classname syntax.  Alternatively, we can use keyword…

Some Concepts of C# Development

Overview – An Interesting Framework C# is an OOP programming language, which is developed by Microsoft.  It can be a bit boring if we just talk about the language itself.  When I started learning to program, I always asked myself what I can do with this language or Framework.   With the Framework, it begins with a general…

Keyword: Static in C#

In C#, static means something cannot be instantiated in our development. In other words, we cannot create an object of a static class, and we access the static members without instantiating an object of a static class. Static Class Apply the static modifier before the class name and after the access modifier (public and private)…

Keyword: Internal & Public, Abstract & Sealed

Internal & Public In C#, once we defined a class and we can instantiate it anywhere else in our project that has access to the definition. By default, classes are declared as internal. With internal, it means the class is only accessible to the code in our current project. On contrast, keyword public allows classes…

Inheritance & Polymorphism in C#

Inheritance and Polymorphism are essential features of C#, and We encounter these features daily. It can be a bit difficult to familiar with these features. In this post, we will explore these two features, have fun. Inheritance Inheritance enables any class (Subclass) inherits from another (Parent-Class), which means Subclass will have all the members of…

Releasing Resource & The Syntax Candy

In C# practice, we may need to read or retrieve information from a text file; such as .text, .pdf and etc. It is a good practice of critical thinking in this scenario, what if other objects or classes need to read this file?The solution can be simple, and we can close the file or source…

Write() and WriteLine() in C#

I have been following some tutorial of C# and encountered an issue of Write() and WriteLine() function. What is the difference between them? They both print text on the console, but they operate differently based on new line character. Write() display the text without providing a new line character; whereas WriteLine() provides us with a…