Operators in C#.

Operators are a fundamental aspect of C# programming. They provide the means to manipulate data, make decisions, and control the flow of your programs. Operators are symbols or keywords that represent specific operations to be performed on operands. These operators are crucial for performing tasks like mathematical calculations, logical evaluations, and type conversions.


C# provides a rich set of operators that can be categorized into various groups, each serving a specific purpose. 

  • Arithmetic Operators
  • Comparison Operators
  • Logical Operators
  • Assignment Operators
  • Bitwise Operators
  • Conditional Operator
Operators are also categorized based on number of operands used in the operation. 
  • Unary Operator: The operator needs one operand to perform the operation. 
  • Binary Operator: The operator needs two operands to perform the operation.
  • Ternary Operator: The operator needs three operands to perform the operation.

Arithmetic Operators.

Arithmetic operators in C# are used to perform basic mathematical operations on numeric operands, such as addition, subtraction, multiplication, division, and modulus. These operators allow you to manipulate numeric data in your C# programs.

  • Addition (+): The addition operator is used to add two numeric values.
  • Subtraction (-): The subtraction operator is used to subtract the right operand from the left operand.
  • Multiplication (*): The multiplication operator is used to multiply two numeric values.
  • Division (/): The division operator is used to divide the left operand by the right operand.
  • Modulus (%): The modulus operator calculates the remainder when the left operand is divided by the right operand.
  • Increment (++) and Decrement (--): Increment and decrement operators are used to increase or decrease the value of a variable by 1. These are also known as urinary operators as they require only one operand to perform the operation.
Example Code:

// C# Code to show the working of Arithmetic Operators
using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        // Addition
        int sum = 5 + 3;
        Console.WriteLine ("Addition Operator: " + sum);
        
        // Subtraction
        int difference = 10 - 3;
        Console.WriteLine ("Subtraction Operator: " + difference);
        
        // Multiplication
        int product = 4 * 6;
        Console.WriteLine ("Production Operator: " + product);
        
        // Division
        int quotient = 15 / 3;
        Console.WriteLine ("Division Operator: " + quotient);
        
        int x = 5;
        // Increment Operator
        x++; // x becomes 6
        Console.WriteLine ("Increment Operator: " + x);
        
        int y = 10;
        // Decrement Operator
        y--; // y becomes 9
        Console.WriteLine ("Decrement Operator: " + y);
    }
}
Output:
Addition Operator: 8
Subtraction Operator: 7
Production Operator: 24
Division Operator: 5
Increment Operator: 6
Decrement Operator: 9

Comparison Operators.

Comparison operators in C# are used to compare two values or expressions and determine the relationship between them. These operators return a Boolean result, true or false, indicating whether the comparison is true or false. Here's a list of comparison operators in C#:
  • Equal (==): The equal operator checks if two values are equal.
  • Not Equal (!=): The not equal operator checks if two values are not equal.
  • Greater Than (>): The greater than operator checks if the left operand is greater than the right operand.
  • Less Than (<): The less than operator checks if the left operand is less than the right operand.
  • Greater Than or Equal To (>=): The greater than or equal to operator checks if the left operand is greater than or equal to the right operand.
  • Less Than or Equal To (<=): The less than or equal to operator checks if the left operand is less than or equal to the right operand.
Example Code:
// C# Code to show the working of Comparison Operators
using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        int a = 5;
        int b = 7;
        bool result;
        
        // Equal Operator
        result = (a == b); 
        Console.WriteLine("Equal to Operator: " + result);
        
        // Not Equal Operator
        result = (a != b);
        Console.WriteLine("Not Equal to Operator: " + result);
        
        // Greater Than Operator
        result = (a > b);
        Console.WriteLine("Greater Than Operator: " + result);
        
        // Less Than Operator
        result = (a < b);
        Console.WriteLine("Less Than Operator: " + result);
        
        // Greater Than or Equal To Operator
        result = (a >= b);
        Console.WriteLine("Greater Than or Equal To Operator: " + result);
        
        // Less Than or Equal To
        result = (a <= b);
        Console.WriteLine("Less Than or Equal To: " + result);
    }
}
Output:
Equal to Operator: False
Not Equal to Operator: True
Greater Than Operator: False
Less Than Operator: True
Greater Than or Equal To Operator: False
Less Than or Equal To: True

Logic Operators.

Logical operators in C# are used to perform logical operations on Boolean values (true or false). They allow you to combine multiple Boolean expressions to make more complex decisions. Here's a list of logical operators in C# along with examples:
  • Logical AND (&&): The logical AND operator returns true if both operands are true, otherwise, it returns false.
  • Logical OR (||): The logical OR operator returns true if at least one of the operands is true, otherwise, it returns false.
  • Logical NOT (!): The logical NOT operator returns the opposite of the operand. If the operand is true, it returns false, and vice versa.
Example Code:
// C# code to show to working of Logical Operators
using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        bool a = true, b = false, result;
        
        // AND Operator
        result = (a && b);
        Console.WriteLine ("AND Operator: " + result);
        
        // OR Operator
        result = (a || b);
        Console.WriteLine ("OR Operator: " + result);
        
        // NOT Operator
        result = (!a);
        Console.WriteLine ("NOT Operator: " + result);
    }
}
Output:
AND Operator: False
OR Operator: True
NOT Operator: False

Logical operators are often used in conditional statements to create more complex conditions.

Example Code:
// C# code to show to working of Logical Operators with Conditional Operators
using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        int age = 25;
        bool isStudent = false;

        if (age >= 18 && !isStudent)
        {
           Console.WriteLine("You are eligible for a driver's license.");
        }
    }
}
Output:
You are eligible for a driver's license.

Assignment Operators.

Assignment operators in C# are used to assign values to variables. They allow you to update the value of a variable based on some operation. Here's a list of assignment operators in C# along with examples:
  • Assignment (=): The assignment operator (=) is used to assign the value on the right-hand side to the variable on the left-hand side.
  • Addition Assignment (+=): The addition assignment operator (+=) is used to add the value on the right-hand side to the variable on the left-hand side and update the variable with the result.
  • Subtraction Assignment (-=): The subtraction assignment operator (-=) is used to subtract the value on the right-hand side from the variable on the left-hand side and update the variable with the result.
  • Multiplication Assignment (*=): The multiplication assignment operator (*=) is used to multiply the variable on the left-hand side by the value on the right-hand side and update the variable with the result.
  • Division Assignment (/=): The division assignment operator (/=) is used to divide the variable on the left-hand side by the value on the right-hand side and update the variable with the result.
  • Modulus Assignment (%=): The modulus assignment operator (%=) is used to find the remainder when the variable on the left-hand side is divided by the value on the right-hand side, and then update the variable with the result.

Example Code:
// C# code to show the working of Assignment Operators
using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        // Assigns the value 10 to the variable x
        int x = 10; 
        Console.WriteLine("Assignment Operator: " + x);
        
        // Equivalent to y = y + 3, updates y to 8
        int y = 5;
        y += 3; 
        Console.WriteLine("Add Assignment Operator: " + y);
        
        // Equivalent to z = z - 4, updates z to 6
        int z = 10;
        z -= 4; 
        Console.WriteLine("Subtraction Assignment Operator: " + z);
        
        // Equivalent to a = a * 2, updates a to 12
        int a = 6;
        a *= 2; 
        Console.WriteLine("Multiplication Assignment Operator: " + a);
        
        // Equivalent to b = b / 4, updates b to 5
        int b = 20;
        b /= 4; 
        Console.WriteLine("Division Assignment Operator: " + b);
        
        // Equivalent to c = c % 7, updates c to 1
        int c = 15;
        c %= 7; 
        Console.WriteLine("Modulus Assignment Operator: " + c);
    }
}
Output:
Assignment Operator: 10
Add Assignment Operator: 8
Subtraction Assignment Operator: 6
Multiplication Assignment Operator: 12
Division Assignment Operator: 5
Modulus Assignment Operator: 1

Assignment operators are commonly used to perform calculations and update variables in a concise manner. They are particularly useful in loops and other situations where variables need to be modified repeatedly.

Bitwise Operators.

Bitwise operators in C# allow you to perform operations on individual bits of integer types. Here's a list of bitwise operators in C# along with examples:
  • Bitwise AND (&): The bitwise AND operator (&) compares each bit of the first operand to the corresponding bit of the second operand. If both bits are 1, the result is 1; otherwise, it's 0.
  • Bitwise OR (|): The bitwise OR operator (|) compares each bit of the first operand to the corresponding bit of the second operand. If either bit is 1, the result is 1; otherwise, it's 0.
  • Bitwise XOR (^): The bitwise XOR operator (^) compares each bit of the first operand to the corresponding bit of the second operand. If the bits are different (one is 0 and the other is 1), the result is 1; otherwise, it's 0.
  • Bitwise NOT (~): The bitwise NOT operator (~) inverts each bit of the operand. It changes 0s to 1s and 1s to 0s.
  • Left Shift (<<): The left shift operator (<<) shifts the bits of the first operand to the left by the number of positions specified by the second operand.
  • Right Shift (>>): The right shift operator (>>) shifts the bits of the first operand to the right by the number of positions specified by the second operand. If the leftmost bit is 0, it fills with 0; if it's 1, it fills with 1.
Example Code:
// C# Code to explain working of Bitwise Operators

using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        int a = 5;    // Binary: 0101
        int b = 3;    // Binary: 0011
        int result;
        
        // Bitwise AND Operator
        result = a & b; 
        Console.WriteLine ("Bitwise AND Operator: " + result);
        
        // Bitwise OR Operator
        result = a | b;
        Console.WriteLine ("Bitwise OR Operator: " + result);
        
        // Bitwise XOR Operator
        result = a ^ b; 
        Console.WriteLine ("Bitwise XOR Operator: " + result);
        
        // Bitwise NOT Operator
        result = ~a;
        Console.WriteLine ("Bitwise NOT Operator: " + result);
        
        // Left Shift Operator
        int leftShifted = a << 2;
        Console.WriteLine ("Bitwise Left Shift Operator: " + leftShifted);
        
        // Right Shift Operator
        int rightShifted = a >> 2;
        Console.WriteLine ("Bitwise Right Shift Operator: " + rightShifted);
    }
}
Output:
Bitwise AND Operator: 1
Bitwise OR Operator: 7
Bitwise XOR Operator: 6
Bitwise NOT Operator: -6
Bitwise Left Shift Operator: 20
Bitwise Right Shift Operator: 1

Conditional Operators.

In C#, the conditional operator, also known as the ternary operator, is a concise way to express conditional statements. It's often used to make decisions in a single line of code.

Syntax:
condition ? expression1 : expression2

Working: The condition is evaluated first. If it's true, expression1 is executed; if it's false, expression2 is executed.

Example Code:
// C# Code to explain working of Ternary Operators

using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        int num = 10;
        // Conditional Operator
        string result = (num % 2 == 0) ? "Even" : "Odd";
        Console.WriteLine(result);
    }
}
Output:
Even


Null Coalescing Operator (??)

The null coalescing operator (??) is used to provide a default value for nullable types or reference types that might be null.

Example Code:
// C# Code to explain working of Null Coalescing Operator

using System;

public class AlgoLesson
{
    public static void Main(string[] args)
    {
        int? nullableValue = null;
        
        int result = nullableValue ?? 10; // result will be 10
        
        Console.WriteLine(result);
    }
}
Output:
10

This guide has covered a wide range of operators in C#, including arithmetic, comparison, logical, assignment, bitwise, and more. Each operator serves a specific purpose and can be a valuable tool in your programming toolkit.

C# Program to Find Sum of All Array Elements.

In this article, we are going to learn how to find the sum of all array elements in C# programming. Here we have an array of size n and we need to sum all n elements of the given array and print the total sum as an output.

Example:

Input: arr[] = {2, 4, 9, 10, 4}
Output: 29

Explanation:
Sum = 2 + 4 + 9 + 10 + 4
    = 29

C# Code to Find Sum of All Array Elements.

// csharp code to find sum of all array elements
using System;

class Program
{
    static void Main()
    {
        // Declare and initialize an array of integers
        int[] numbers = { 2, 4, 6, 8, 10 };

        // Initialize a variable to store the sum
        int sum = 0;

        // Iterate through the array and add each element to the sum
        foreach (int num in numbers)
        {
            sum += num;
        }

        // Print the result
        Console.WriteLine("The sum of the array elements is: " + sum);
    }
}
Output:
The sum of the array elements is: 30

Working of Above Code:
  • We declare an array of integers called numbers and initialize it with some values.
  • An integer variable named sum is initialized to zero. This variable will store the sum of the array elements.
  • We use a foreach loop to iterate through each element (num) in the numbers array.
  • Inside the loop, we add each element's value to the sum variable.
  • Finally, we print the sum to the console.

Data Types in C#.

Data types in C# are fundamental building blocks that define the kind of data a variable can hold. As C# is a strongly typed language, variables and expressions must have consistent data types and type conversions are limited or controlled by the language rules. 

Before learning about different data types and their usage let us learn what is data type and why it is important.

Data Types in C#

What is Data Types?

In programming, data types specify the type of data that can be stored in a variable. They determine the size, format, and range of values that a variable can hold. C# provides a rich set of data types, which can be broadly categorized into two groups: 

  • Value Types 
  • Reference Types.


Value Types C#.

Value types represent data directly, and their values are stored directly in memory. When you work with a value type, you manipulate the actual data rather than a reference to it.

Here is the list of some common value types in C#:

  • Integer Types: int, unit, short, ushort, long, ulong.  
  • Floating-Point Types: float, double, decimal.
  • Boolean Type: bool.
  • Character Type: char.
  • Enumerations: A user-defined value type that consists of a set of named integral constants. 
  • Nullable Value Types: Allows value types to have a value of null in addition to their normal range of values.
  • User-Defined Types: You can also define your own data types using classes and structs, making C# highly extensible and suitable for complex data modeling.
Example:
// Integer Types 
int myInt = 42;
uint myUInt = 12345U;
short myShort = -12345;
ushort myUShort = 56789;
long myLong = 123456789012345L;
ulong myULong = 987654321012345UL;

// Floating-Point Types
float myFloat = 3.1415927f;
double myDouble = 2.718281828459045;
decimal myDecimal = 123.456m;

// Boolean Type
bool isTrue = true;
bool isFalse = false;

// Character Type
char myChar = 'A';



Reference Type in C#.

Reference types store references (memory addresses) to the actual data. When you work with a reference type, you manipulate a reference to the data rather than the data itself. 

Here are some common reference types in C#:
  • String Type: Represents a sequence of characters (a string of text).
  • Object Type: The base type for all other types in C#. It can hold values of any data type.
Example:
string myString = "Hello, World!";

object myObject = 42;

List of Data Types in C#.

Here's a summary of common data types in C#, along with their characteristics and valid value ranges:

Data Type Description Valid Range or Values
int 32-bit signed integer -2,147,483,648 to 2,147,483,647
uint 32-bit unsigned integer 0 to 4,294,967,295
short 16-bit signed integer -32,768 to 32,767
ushort 16-bit unsigned integer 0 to 65,535
long 64-bit signed integer -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
ulong 64-bit unsigned integer 0 to 18,446,744,073,709,551,615
float Single-precision float ±1.5 x 10^-45 to ±3.4 x 10^38
double Double-precision float ±5.0 x 10^-324 to ±1.7 x 10^308
decimal Decimal float ±1.0 x 10^-28 to ±7.9 x 10^28
bool Boolean value true or false
char Unicode character Any valid Unicode character
string Sequence of characters Any string of text
object Base type for all types Any C# data type
enum User-defined constants A set of named integral constants

Variables in C#.

Variables are fundamental building blocks in the world of programming. They serve as containers for storing data that your program can read, modify, and utilize during its execution. In this article, we are going to learn about the types of variables available in C# and how to declare and define them in our program.


Types of Variables in C#.

In C#, variables come in two primary categories: value types and reference types. The choice between these types depends on the kind of data you want to store and how you intend to use it. Let's learn each type one by one in detail.


1. Value Type Variables.

Value types directly store the data value itself. They are stored in memory, and when you copy or pass a value type variable to a method or another variable, you're working with a copy of the actual data. 

Here is the list of a few commonly used Value Type variables in C#:

  • int: Represents integer numbers.
  • float: Represents single-precision floating-point numbers.
  • double: Represents double-precision floating-point numbers.
  • bool: Represents Boolean values (true or false).
  • char: Represents a single character.
  • struct: Represents user-defined value types.

Example:

// Value type variables
int age = 25;
float temperature = 98.6f;
bool isStudent = true;

2. Reference Type Variables.

Reference types store a reference (memory address) to the actual data stored elsewhere in memory. When you copy or pass a reference type variable, you're working with a reference to the same data.

Here is the list of a few commonly used Reference Type variables in C#:

    • string: Represents a sequence of characters.
    • class: Represents user-defined reference types.
    • interface: Defines a contract for classes to implement.
    • delegate: Represents a method that can be passed as an argument.
    • object: The base type for all other types in C#.
    Example:
    // Reference Type Variable
    string name = "John";
    List<int> numbers = new List<int> { 1, 2, 3 };
    

    Declaring and Initializing Variables.

    In C#, you declare a variable by specifying its data type followed by a name for the variable. You can also assign an initial value during declaration or assign a value later in your code. 

    Example:
    // Declaration with initialization
    int age = 25;
    
    // Declaration without initialization
    float temperature;
    
    // Assignment after declaration
    temperature = 98.6f;
    

    You can also declare multiple variables of the same type in a single line:
    int x = 5, y = 10, z = 15;
    

    Rules for Variable Names.

    Variable names in C# must adhere to specific rules to ensure the readability and maintainability of your code. Here are some essential rules for naming variables:
    • Variable names are case-sensitive, so myVariable and MyVariable are different.
    • Names can consist of letters, digits, and the underscore character _.
    • Names must begin with a letter or an underscore.
    • Variable names cannot be a C# keyword or reserved word (e.g., int, class, if).
    Here are some examples of invalid variable names:
    int 123number;         // Starts with a digit.
    string my-variable;    // Contains an invalid character (-).
    double if;             // Uses a C# keyword as a name.
    

    Best Practice for Variable Naming.

    To write clean, maintainable code, consider following these best practices for variable naming:
    • Use descriptive names that convey the variable's purpose. For example, use totalAmount instead of amt.
    • Follow a consistent naming convention. Common conventions include PascalCase for class names (MyClass), camelCase for method and variable names (myVariable), and UPPERCASE for constants (MAX_VALUE).
    • Avoid using single-letter variable names, except for loop counters (i, j, k) or generic type parameters (T).
    • Use meaningful prefixes or suffixes when necessary. For instance, prefix boolean variables with "is" or "has" (isLoggedIn, hasPermission).
    • Keep variable names concise but not overly abbreviated. Aim for a balance between clarity and brevity.
    I hope you got a basic understanding of variables in C# and how to define or declare them. You should always create a meaningful variable that helps others to understand the use and purpose of that variable in the program.

    C# Keywords and Identifiers.

    When you dive into the world of C# programming, you encounter various building blocks that form the foundation of your code. Two fundamental concepts you'll frequently encounter are keywords and identifiers. Understanding what these are, how they work, and their significance is crucial for writing clean, efficient, and readable code.

    Keywords in C#.

    Keywords are predefined words in C# that have special meanings and purposes. They are reserved for specific roles within the language and cannot be used as identifiers, such as variable or method names. Keywords provide the structure and logic for your code.

    C# has a rich set of keywords that are integral to its syntax and functionality. Let's explore some of these keywords with examples:

    Example:
    class Person {
        public string Name { get; set; }
        
        public void Greet() {
            Console.WriteLine("Hello, " + Name);
        }
    }
    

    Here, class, public, string, get, set, void, return, and Console are keywords used to define a class and its properties and methods. 

    Identifiers in C#.

    Identifiers are user-defined names for program elements such as variables, classes, methods, and parameters. They help make your code more readable and understandable. 

    Identifiers must adhere to these rules:
    • Begin with a letter (uppercase or lowercase) or an underscore.
    • Subsequent characters can be letters, digits, or underscores.
    • C# is case-sensitive, so MyVariable and myvariable are distinct identifiers.
    • Avoid using C# keywords as identifiers.
    Valid identifiers: myVariable, _privateField, CalculateArea, StudentRecord.
    Invalid identifiers: 3rdPlace (starts with a digit), class (a C# keyword).

    Example:
    int numberOfApples = 10;
    string studentName = "John";
    

    In this example, numberOfApples and studentName are identifiers used for variables.

    Use of Keywords and Identifiers.

    Keywords and identifiers work together in C# code to create and manipulate program elements.

    1. Keywords and Identifiers are used together for Declaring Variables.
    int age; // 'int' is a keyword, 'age' is an identifier
    age = 25;
    

    2. Keywords and Identifiers are used together for Defining Classes.
    class Circle {
        public double Radius { get; set; } // 'class', 'public', 'double', and 'Radius' are keywords and identifiers
        public double CalculateArea() {
            return Math.PI * Radius * Radius; // 'Math', 'PI', '*' are keywords and identifiers
        }
    }
    

    3. Keywords and Identifiers are used together for Method Naming.
    public void SayHello(string name) {
        Console.WriteLine("Hello, " + name); // 'SayHello', 'string', 'name', '+' are keywords and identifiers
    }
    

    From the above examples, you got an idea of how and where we can use keywords and identifiers in our C# code. 

    Contextual Keywords in C#.

    Contextual keywords in C# are a special set of identifiers with a specific meaning within a particular context in the C# programming language. Unlike regular keywords, which have predefined meanings and cannot be used as identifiers, contextual keywords only have significance in specific code contexts where they are relevant. In other contexts, they can be used as regular identifiers like variable names or class names.

    Example:
    // Contextual Keywords
    var query = from student in students
                where student.Age > 18
                select student;
    

    Here in the above example, var, from, where, and select are contextual keywords used in LINQ queries.

    Conclusion.

    Keywords and identifiers are the building blocks of your C# code. Keywords define the language's structure and logic, while identifiers give names to program elements. Understanding their roles and using them effectively is essential for writing clean, maintainable code.

    C# Sharp History and Versions.

    C# (pronounced "C-sharp") is a versatile, high-level programming language developed by Microsoft Corporation. Since its inception, C# has become one of the most popular and widely used programming languages, powering a broad range of applications in various domains.

    Founder of C# Programming Anders Hejlsberg

    History of C# Programming.

    C# was created by Microsoft as part of its .NET initiative in the early 2000s. The language was designed by Anders Hejlsberg, a Danish computer programmer with a remarkable track record in developing programming languages. Hejlsberg had previously worked on Turbo Pascal and Delphi, and his expertise greatly contributed to C#'s success.

    The development of C# began in 1999, and it was officially introduced to the public in 2000 as part of Microsoft's .NET Framework 1.0. C# was positioned as the primary language for building Windows applications on the .NET platform.

    C# Relation with .Net.

    C# is closely associated with the .NET ecosystem, a comprehensive framework for building Windows applications and web services. The language was designed to work seamlessly with the .NET Framework, enabling developers to create a wide range of applications, from desktop software to web applications and cloud services.

    Different Versions of C# Available.

    C# has gone through several iterations, with each version introducing new features, improvements, and capabilities. Here is a brief overview of the major C# versions:

    C# 1.0 (2000): The initial release of C# included fundamental features like classes, inheritance, interfaces, and garbage collection. It was tightly integrated with the .NET Framework 1.0.

    C# 2.0 (2005): C# 2.0 brought generics, partial classes, anonymous methods, and nullable value types. These additions improved code reusability and made it easier to work with collections.

    C# 3.0 (2007): C# 3.0 introduced language enhancements such as lambda expressions, extension methods, and the LINQ (Language Integrated Query) framework. These features streamlined data manipulation and querying.

    C# 4.0 (2010): Version 4.0 introduced optional and named parameters, dynamic types, and improved support for COM interop. These additions enhanced code flexibility and interoperation with other languages.


    C# 5.0 (2012): C# 5.0 introduced asynchronous programming using the async and await keywords. This feature simplified the development of asynchronous and responsive applications.


    C# 6.0 (2015): C# 6.0 added features like string interpolation, null-conditional operators (?. and ?[]), and read-only properties and auto-properties. These features aimed to improve code readability and reduce boilerplate code.


    C# 7.0 (2017): C# 7.0 brought enhancements such as pattern matching, local functions, and tuples. These features enhanced code expressiveness and simplification.

    C# 8.0 (2019): C# 8.0 introduced several significant features, including nullable reference types, asynchronous streams, and default interface methods. These additions improved code safety and versatility.

    C# 9.0 (2020): C# 9.0, introduced record types, pattern-matching improvements, and new features for simplifying code. It also introduced source generators, allowing developers to generate code at compile time.

    C# 10.0 (2021): C# 10.0 was released in the year 2021 and contains several features like global using directives, interpolated strings as format strings, file-scoped namespaces, and more.

    DON'T MISS

    Nature, Health, Fitness
    © all rights reserved
    made with by templateszoo