Let's continue our C# in Simple Terms series with one of the basic parts of any line of code: the operators.
In C#, operators _are often symbols, groups of symbols, or words. The operators perform various functions against values, called _operands, that most commonly appear on either side of the operator.
int total = 5 * 5; //This line has two operators; //the * (multiplication) operator //which takes 5 and 5 as inputs //and the = (assignment) operator //which assigns the result of 5*5 to the variable total
This article does not cover all possible operators in C#; some were already talked about in the Casting and Conversion post (
as), some are left out of this series due to being more advanced topics (bitwise and shift and pointer-related operators) and some will be discussed in future articles.
For the most part, operators follow this structure:
var value = operand1 operator operand2;
The operands are the values on which the operator will operate.
The assignment and equality operators are the most basic of the C## operators, and the most common; they are used to assign values to variables and to check if two objects have the same value.
Now that we understand a little more about classes and previously learned the difference between value types and reference types, it's time to explore some more specialized C# types. In today's edition of C# in Simple Terms, let's explore two useful value types: structs and enums.
In the past, we have used mega-series to tackle big subjects such as design patterns, anti-patterns, and sorting algorithms. In this series, we're going back to basics to discover, learn, and teach the programming language we all know and love: C#!
Now that we've discussed most of the basics we need for a C# program, let's talk about two concepts that are central to how C# (and indeed, all object-oriented programming languages) work: inheritance and polymorphism.
In this article, the latest of our C# in Simple Terms series, we're going to discuss how to control the flow of execution in a C# program. This means we will answer the question, "how does the code know what to do next?"
C/C++ problems. If you are familiar with C/C++then you must have come across some unusual things and if you haven’t, then you are about to. The below codes are checked twice before adding, so feel free to share this article with your friends.