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
  • HTML
  • JAVA
  • JavaScript
  • jQuery
  • Mybb Plugins
  • MySQL
  • PHP
  • Python
  • React
  • SQL

Recent Posts

  • jQuery – The noConflict() Method
  • jQuery – AJAX get() and post() Methods
  • jQuery – AJAX load() Method
  • jQuery – AJAX Introduction
  • jQuery Traversing – Filtering

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