EloiStree / 2024_07_19_CharleroiStreetAR

Apprendre à faire Unity3D par le street AR pour commencer dans l'industrie du jeux vidéo
0 stars 0 forks source link

Note, 2024_10_07: Bonjour C# #219

Open EloiStree opened 1 month ago

EloiStree commented 1 month ago

Kapla git pour le package manager: https://github.com/EloiStree/2024_10_06_KaplaPlanksPack

´´´ True, False: bool (boolean) 1 0 : bit (1111 1111) : byte de 8 bits 42 , 2501 , -1, 0: int (integer) 3.141593 : float (un nombre décimal) 3.141592653589793 : double

public class MonVector3{ public float x =0; public float y =0; public float z =0; }

public class MonTransform{ public MonVector3 position; public MonVector3 rotation; public MonVector3 scale; }

String pi = "3.14159265358979323846264338327950288419716939937510"; char[] piArray = pi.ToCharArray(); foreach (char c in piArray) { Debug.Log("Decimal:"+c); }

Alpha numérique : AZaz09_ ´´´

EloiStree commented 1 month ago

In C#, primitive types (also known as value types) are the basic data types that are built into the language and represent simple values. Here are the primitive types in C#:

Type Description Default Value Size Example
bool Boolean, true or false false 1 byte bool isActive = true;
byte 8-bit unsigned integer 0 1 byte byte age = 255;
sbyte 8-bit signed integer 0 1 byte sbyte score = -5;
char Single 16-bit Unicode char '\0' 2 bytes char letter = 'A';
decimal 128-bit precise decimal 0.0M 16 bytes decimal price = 99.99M;
double 64-bit floating-point 0.0 8 bytes double weight = 70.5;
float 32-bit floating-point 0.0f 4 bytes float length = 5.4f;
int 32-bit signed integer 0 4 bytes int count = 100;
uint 32-bit unsigned integer 0 4 bytes uint age = 50;
long 64-bit signed integer 0L 8 bytes long distance = 5000L;
ulong 64-bit unsigned integer 0 8 bytes ulong value = 1000;
short 16-bit signed integer 0 2 bytes short temp = -300;
ushort 16-bit unsigned integer 0 2 bytes ushort max = 400;

Additionally, there's a string type, often considered a fundamental type in C#, though it's not technically a primitive but rather a reference type representing a sequence of characters.

In Unity, these primitive types are frequently used for component properties, transformations, player input, and data processing. Each primitive type has a default value assigned when declared but not explicitly initialized.