Answers for "Variable type c#"

C#
4

c# data types

// -------DATA TYPES ------- //

sbyte myNum = 1;             // Smallest range of integer numbers
uint myNum = 3;				 // Only positive integer numbers
short myNum = 4;             // Short range of integer numbers
int myNum = 5;               // Integer (whole numbers)
long myNum = 10;             // Biggest range of integer numbers 
float myFloat = 1.2f;        // Smallest range of floating point numbers
double myDoubleNum = 5.99;   // Big range of floating point numbers
decimal myDecimalNum = 2.2M; // Biggest precision in floating point numbers
char myLetter = 'D';         // Character
string myString = "Hello!"   // Strings
bool myBool = true;          // Boolean
Posted by: Guest on August-25-2020
0

C# Data Type

short s1 = -32768;
short s2 = 32767;
short s3 = 35000;//Compile-time error: Constant value '35000' cannot be converted to a 'short'

ushort us1 = 65535;
ushort us2 = -32000; //Compile-time error: Constant value '-32000' cannot be converted to a 'ushort'

Console.WriteLine(Int16.MaxValue);//32767
Console.WriteLine(Int16.MinValue);//-32768
Console.WriteLine(UInt16.MaxValue);//65535
Console.WriteLine(UInt16.MinValue);//0
Posted by: Guest on April-23-2021
0

variablen typen c#

byte vByte = 200;                                   // 0 bis 255
sbyte vSByte = -45;                                 // -128 bis 127
short vShort = -15784;                              // -32.768 bis 32.767
ushort vUShort = 45960;                             // 0 bis 65.535
int vInt = -1894112307;                             // -2.147.483.648 bis 2.147.483.647
uint vUInt = 3489215047;                            // 0 bis 4.294.967.296
long vLong = -3996794549303736183;                  // -9.223.372.036.854.775.808 bis 9.223.372.036.854.775.807
ulong vULong = 14125657448224163497;                // 0 bis 18.446.744.073.709.551.615
float vFloat = 39751.48f;                           // -3.402823e38 bis 3.402823e38
double vDouble = 976252561462.7912;                 // -1.79769313486232e308 bis 1.79769313486232e308
decimal vDecimal = 644186892645655128968.34768426M; // +/- 1,0 × 10e?28 zu +/- 7,9 × 10e28
bool vBool = false;                                 // true (1) oder false (0)
char vChar = 'c';                                   // Unicode-Zeichen (0 - 65.535)
string vString = "Hallo Welt!";                     // Aneinanderreiung von char-Typen
object vObject = new Program();                     // globaler Typ für alle Objekte
Posted by: Guest on April-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language