About 26,700,000 results
Open links in new tab
  1. C# Variables - W3Schools

    C# Variables. Variables are containers for storing data values. In C#, there are different types of variables (defined with different keywords), for example: int - stores integers (whole numbers), without decimals, such as 123 or -123; double - stores floating point numbers, with decimals, such as 19.99 or -19.99

  2. c# - How to initialize var? - Stack Overflow

    May 25, 2010 · A var cannot be set to null since it needs to be statically typed. var foo = null; // compiler goes: "Huh, what's that type of foo?" However, you can use this construct to work around the issue:

  3. Declaration statements - local variables and constants, var, local ...

    Jun 21, 2023 · A declaration statement declares a new local variable, local constant, or local reference variable. To declare a local variable, specify its type and provide its name. You can declare multiple variables of the same type in one statement, as the following example shows: string greeting; int a, b, c; List<double> xs;

  4. C# Variables - GeeksforGeeks

    Jan 11, 2025 · In C#, variables are containers used to store data values during program execution. So basically, a Variable is a placeholder of the information which can be changed at runtime. And variables allows to Retrieve and Manipulate the stored information.

  5. C# Variables: Declare, Access & Use Variables

    In C#, a variable stores a value of the specific data type. It can store a numeric, char, string, or other types of value. You can declare and assign a value to a variable like int x = 5; where int is the data type, x is the name of a variable, = is an operator that assigns the value to a variable, and 5 is the integer value assigned to a ...

  6. C# Variables - C# Tutorial

    In this tutorial, you'll learn about C# variables including declaring variables, assigning values to variables, and displaying variables.

  7. Variables - C# language specification | Microsoft Learn

    C# defines eight categories of variables: static variables, instance variables, array elements, value parameters, input parameters, reference parameters, output parameters, and local variables. The subclauses that follow describe each of these categories. Example: In the following code. public static int x; int y;

  8. Variables in C# with Examples - Dot Net Tutorials

    Jan 7, 2023 · The following is the syntax to declare a variable by setting the identity of the memory location in the C# language. First, we need to write the data type followed by the identifier. Syntax: data_type Identifier; Example: int a; //Here int is the data type and the identifier can be any name and here we set it as a.

  9. Introduction to C# Variables - Online Tutorials Library

    Declaring Variables in C#. In C#, you declare a variable by specifying its data type and a variable name. Syntax. Here's the basic syntax to declare a variable: <data_type> <variable_name>; Example int age; string name; C# Variable Initialization. After declaring a variable, you can initialize it with a value. Example. Here's an example of how ...

  10. C# Variables (initialization, declaration, syntax and example)

    Oct 3, 2020 · How to declare variable in C#? It is simple to declare a variable and it must be declared before the use of that variable. You need to specify the data-type for the variable and also give it a unique name.

  11. Some results have been removed