---
# System prepended metadata

title: Untitled

---

### C# Notes
##### Author: Ardy Ghoorchian 

---
**Overview:**
1. C# Object orineted
2. by Microsft made by Anders Hejlsberg
---


**DataTypes**:
```clike=
int myNum = 5;               // Integer (whole number)
double myDoubleNum = 5.99D;  // Floating point number
char myLetter = 'D';         // Character
bool myBool = true;          // Boolean
string myText = "Hello";     // String
```


<table class="table table-bordered">
<tbody><tr>
<th class="ts" width="10%">Type</th>
<th class="ts" width="35%">Represents</th>
<th class="ts" width="45%">Range</th>
<th style="width:10%;">Default Value</th>
</tr>
<tr>
<td style="text-align:center;">bool</td>
<td>Boolean value</td>
<td>True or False</td>
<td style="text-align:center;">False</td>
</tr>
<tr>
<td style="text-align:center;">byte</td>
<td>8-bit unsigned integer</td>
<td>0 to 255</td>
<td style="text-align:center;">0</td>
</tr>
<tr>
<td style="text-align:center;">char</td>
<td>16-bit Unicode character</td>
<td>U +0000 to U +ffff</td>
<td style="text-align:center;">'\0'</td>
</tr>
<tr>
<td class="ts">decimal</td>
<td>128-bit precise decimal values with 28-29 significant digits</td>
<td style="vertical-align:middle;">(-7.9 x 10<sup>28</sup> to 7.9 x 10<sup>28</sup>) 
/ 10<sup>0</sup> to 28
</td>
<td class="ts">0.0M</td>
</tr>
<tr>
<td class="ts">double</td>
<td>64-bit double-precision floating point type</td>
<td>(+/-)5.0 x 10<sup>-324</sup> to (+/-)1.7 x 10<sup>308</sup></td>
<td class="ts">0.0D</td>
</tr>
<tr>
<td class="ts">float</td>
<td>32-bit single-precision floating point type</td>
<td style="vertical-align:middle;">-3.4 x 10<sup>38</sup> to + 3.4 x 10<sup>38</sup></td>
<td class="ts">0.0F</td>
</tr>
<tr>
<td class="ts">int</td>
<td>32-bit signed integer type</td>
<td style="vertical-align:middle;">-2,147,483,648 to 2,147,483,647</td>
<td class="ts">0</td>
</tr>
<tr>
<td class="ts">long</td>
<td>64-bit signed integer type</td>
<td>-9,223,372,036,854,775,808 to 
9,223,372,036,854,775,807
</td>
<td class="ts">0L</td>
</tr>
<tr>
<td style="text-align:center;">sbyte</td>
<td>8-bit signed integer type</td>
<td>-128 to 127</td>
<td style="text-align:center;">0</td>
</tr>
<tr>
<td class="ts">short</td>
<td>16-bit signed integer type</td>
<td style="vertical-align:middle;">-32,768 to 32,767</td>
<td class="ts">0</td>
</tr>
<tr>
<td class="ts">uint</td>
<td>32-bit unsigned integer type</td>
<td style="vertical-align:middle;">0 to 4,294,967,295</td>
<td class="ts">0</td>
</tr>
<tr>
<td class="ts">ulong</td>
<td>64-bit unsigned integer type</td>
<td style="vertical-align:middle;">0 to 18,446,744,073,709,551,615</td>
<td class="ts">0</td>
</tr>
<tr>
<td class="ts">ushort</td>
<td>16-bit unsigned integer type</td>
<td style="vertical-align:middle;">0 to 65,535</td>
<td class="ts">0</td>
</tr>
</tbody></table>

You may call `.GetType()` to get the tyope of a variable in C#.

---

**Mathmateical Arithmitic:**

1. `+` add 
2. `-` sub 
3. `*` multipy
4. `/` div 
5. `%` modulus 

```clike=
    Console.WriteLine(1 + 2);
    Console.WriteLine(1 * 2);
    Console.WriteLine(1 / 2);   # this will be an ineteger div (no fractions) 
    Console.WriteLine(1 - 2);
    Console.WriteLine(10 % 2);  # this means give me the remainder of 10 / 2 
    Console.WriteLine(1 / 0);   # div by zero is not allowed in C#
```

---