# 1.1: Data Types

In this module we will study various types in C#.

## Definition

Types will be attached to any part of your application that has do with your data and values. Every variable, constant, and expression that gives back a value has a type. Every method has a type for the input value. The .NET Framework class library comes with built in numeric types as well as more complicated types that represent information such as file system, network connections, collections and arrays of objects, and dates.

## Basic Types Within C\#

| **Type**  | **Name**  | **Example**           | **Description**                                                                                                                 |
| --------- | --------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Integer   | `int`     | 20, -1500             | A whole number with a size of 32 bits and range from -2,147,483,648 to 2,147,483,647                                            |
| Float     | `float`   | 1.5f                  | 32 bit, up to 7 digits                                                                                                          |
| Double    | `double`  | 1.500000d             | 64 bit, up to 15-16 digits                                                                                                      |
| Decimal   | `decimal` | 8.333333333333333333m | 128 bit, up to 28-29 digits, more precise than `double` or `float`, but also more costly.  Mainly used for financial situations |
| Boolean   | `bool`    | true, false           | A true or false statement                                                                                                       |
| String    | `string`  | "Hello World"         | A collection of characters with a size of up to 2 gigs                                                                          |
| Character | `char`    | A                     | A single character with a size of 16 bits                                                                                       |

These are some of the basic types C# uses and examples of when to use the different types. [Here](https://github.com/ElevenfiftyAcademy/DotNet-101-151-CSharpFundamentalsApps/tree/3689f4f1834920a48d3075e0c7081ce20797a69d/docs/Part1/1.0a-DataTypesTable.md) is more detail on types in C#.

## Practice Question

* Consider the values below. What is the best type to associate with each one of these items?
  * D
  * 23
  * $3.3333333
  * 15.25
  * -3500
  * Hi!
* Answers:
  * `char`
  * `int`
  * `decimal`
  * `float`
  * `int`
  * `string`

[Next:](/dotnet-101-csharpfundamentals/part-1-data-types/1.2-data-types-table.md) Data Types Table


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eleven-fifty-academy.gitbook.io/dotnet-101-csharpfundamentals/part-1-data-types/1.1-data-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
