Definition - What does Variable mean?
C# language is designed to be "type-safe," which helps ensure that the value stored in a variable is of the appropriate type. The type of a variable specifies what kind of data it can hold. This feature helps to reduce the burden from the programmer by guaranteeing the data's type safety.
Unlike loosely typed languages such as Jscript, C# expects the data type of a variable to be specified during declaration, which helps to allocate the memory for the variable during run time. In order to maintain the integrity of the data stored in a variable, C# defines a set of rules that dictate the permissible operations that can be performed on the variable.
Techopedia explains Variable
A variable can be a value or reference type. While variables of value type are stored on the stack, reference type variables are created on the heap with the reference to the allocated memory stored in the stack.
For example, a variable, "StudentName," can be declared as a string variable of reference type.
A variable that has been declared with a specific type cannot be redeclared with a new type. A variable of a particular type can be converted to another type using implicit type conversion or explicit conversion (cast). While implicit conversion does not incur any loss of data and occurs during compile-time, cast might cause data loss during run time.
Join thousands of others with our weekly newsletter
The 4th Era of IT Infrastructure: Superconverged Systems:
Approaches and Benefits of Network Virtualization:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: