Polymorphism is one of the three basic components of Object Oriented Programming (OOP). Polymorphism literally means having multiple shapes. In terms of programming, it is referred to as “one interface, multiple functions.” In C#, polymorphism is implemented via method overloading, method overriding and inheritance. We will look at all of these concepts in detail in this article. Polymorphism can be broadly classified into two categories: static polymorphism and dynamic polymorphism. Static polymorphism is implemented via method overloading, and dynamic polymorphism is implemented via inheritance and method overriding.
In one of my previous articles, I introduced you to object-oriented programming (OOP). There are three pillars of OOP which are cumulatively known as PIE: Polymorphism, Inheritance, and Encapsulation. In this article, we will focus on Inheritance and the different ways of implementing inheritance in C#.
A few weeks ago I was tasked with creating a very large CSV file with some dynamic content. I decided that this would be an excellent opportunity to try out some of my C# skills and write the content of the file using a loop. I quickly realized that not all methods of writing files to the hard drive perform the same. In fact, some methods are just plain terrible. I decided to write this article to compare different ways to write text files and evaluate their performance.
In today’s tutorial, we are going to make a number guessing game in C#. We will learn how to generate random numbers, get user input, and decide if the user guesses the correct number. This tutorial will be relatively short compared to some of my other tutorials.
In today’s tutorial, I am going to show you how to reverse a string. While I know this does not sound impressive, it does give you a look into how you can manipulate strings in the future. By the end of this tutorial, you will be able to split a string up into individual characters and then manipulate them.