C#

# C# - types and variables

**basic data types****logical**boolean data type:**bool****numbers**- types for storing numbers.**integers**- types for storing integers.**unsigned**- types for storing unsigned integers.

8-bit unsigned integer:**byte**,**UInt8**16-bit unsigned integer:**ushort**,**UInt16**32-bit unsigned integer:**uint**,**UInt32**64-bit unsigned integer:**ulong**,**UInt64****signed**- types for storing signed integers.

8-bit integer:**sbyte**,**Int8**16-bit integer:**short**,**Int16**32-bit integer:**int**,**Int32**64-bit integer:**long**,**Int64**

**real numbers**32-bit real number:**float**64-bit real number:**double**

**type conversions****explicit**- using an explicit type conversion we can change the type of existing types.

to 8-bit integer to 8-bit unsigned integer to 16-bit integer to 16-bit unsigned integer to 32-bit integer to 32-bit unsigned integer to 64-bit integer to 64-bit unsigned integer to 32-bit real number to 64-bit real number to boolean

**variables**- variable is used for storing the data. can be declared in different locations and can be used in different locations. it can be distinguished according to the lifetime: they are global or local static variables. it is possible use in the structure or function.

variable declaration variable use**automatic variable**- automatic variable declaration is allowed almost anywhere, lifetime is usually from the declaration to the end of the current block.

automatic variable declaration

### Examples - C#

Other pieces of example codes:C# |
---|

z = (int)(x * y) ushort x=280; y =(double)(x * y) bool b = x; y = (long)(x * y) y = (byte)(x * y) |

programming languages