C# Type Casting
C# Type Casting Type casting in C# is the process of converting one data type into another. It is commonly used when working with different data types in calculations, input, or output. 🔹 Types...
C# Type Casting Type casting in C# is the process of converting one data type into another. It is commonly used when working with different data types in calculations, input, or output. 🔹 Types...
C# Data Types Data types in C# define the type of data a variable can store, such as numbers, text, or boolean values. C# is a strongly typed language, so every variable must have...
C# Identifiers Identifiers in C# are the names given to program elements such as variables, methods, classes, interfaces, and namespaces. They are used to identify these elements in your code. What is an Identifier?...
C# Multiple Variables In C# Multiple Variables in a single line or across multiple lines, as long as they are of the same data type. Declare Multiple Variables in One Line
|
1 |
int x = 5, y = 10, z = 15; |
Declare Multiple Variables,...
C# Display Variables In C#, displaying variables means showing their values as output, usually on the console. This is commonly done using the Console class. Display a Variable
|
1 2 |
int age = 25; Console.WriteLine(age); |
Output: 25 Display Text and...
C# Constants Constants in C# are variables whose value cannot be changed once it is assigned. They are useful for storing fixed values like PI, tax rates, or configuration values. Declaring Constants Use the...
C# Variables Variables in C# are used to store data that can be used and changed during program execution. What is a Variable? A variable is a named memory location that holds a value....
C# Comments Comments in C# are used to explain code, make it more readable, and disable code temporarily. Comments are ignored by the compiler. Types of Comments in C# 1️⃣ Single-Line Comment (//) Used...
C# Output In C#, output is used to display text or data to the user. This is mainly done using the Console class. Console.WriteLine() Prints output and moves to a new line.
|
1 2 |
Console.WriteLine("Hello World"); Console.WriteLine("Welcome to C#"); |
Output:...
C# Syntax C# syntax defines how C# programs are written and structured. It is clean, readable, and similar to Java and C++. Basic Structure of a C# Program
|
1 2 3 4 5 6 7 8 9 |
using System; class Program { static void Main() { Console.WriteLine("Welcome to C#"); } } |
Key Syntax Rules 1....