Skip to content
Iampsp Blog

Iampsp Blog

I am a programming service provider

My Portfolio
Project order
Reviews
Favorite Exchange

Categories

  • C
  • C#
  • C++
  • CSS
  • Firefox Addons
  • Firefox Themes
  • Gaming
  • HTML
  • JAVA
  • JavaScript
  • jQuery
  • Mybb Plugins
  • MySQL
  • PHP
  • Python
  • React
  • SQL
  • Web Services
  • XML

Recent Posts

  • Top 6 Best Minecraft Server Hosting Options in 2025
  • Top 15 Most Popular Google Doodle Games in 2025
  • Top 11 IRC Clients for Windows, macOS, and Linux in 2025
  • Top 10 Open Source Video Games in 2025
  • Top 10 Free Image Hosting Services for 2025

C# Multiple Variables

Declare Many Variables

To declare more than one variable of the same type, use a comma-separated list:

Example

int x = 5, y = 6, z = 50;
Console.WriteLine(x + y + z);

 

You can also assign the same value to multiple variables in one line:

Example

int x, y, z;
x = y = z = 50;
Console.WriteLine(x + y + z);
Posted on 2025-05-04Author MostafaCategories C#Tags c switch case, c# dictionary, c# enum, c# multiple values, c# multiple values dictionary, c# multiple values in case, c# multiple values per key, c# multiple variable assignment, c# multiple variable declaration, c# multiple variable declaration and initialization, c# multiple variable initialization, c# multiple variables in using, c# operator, c# struct, c# ternary operator, c# vs java, c++, c++ list, c++ multiple variables in for loop, c++ online compiler, learn c#, learn c# and .net, learn c# basics, learn c# book, learn c# for free, learn c# for game development, learn c# for unity, learn c# in one day, learn c# microsoft, learn c# reddit

Post navigation

Previous Previous post: C# Display Variables
Next Next post: C# Identifiers
Proudly powered by WordPress