Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
1. Basics: primitive data types
//1. Basics: primitive data types using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //these are most common: //int (32 bit integer), long (64 bit integer), double, string, decimal int I_m_int = 5; double I_m_double = 5.5; string I_m_string = "hey"; decimal I_m_decimal = 15.13M; //These are passed by value, i.e. when you supply it as a function parameter the whole value is copied MutateString(I_m_string); Console.WriteLine(I_m_string); //we have mutated a copy and the original stayed intact //The above variables are non-nullable, you can't assign them null //If you need nullable ones use ? unary operator int? I_m_nullable_int = null; //same as above Nullable<int> I_m_another_nullable_int = null; Console.WriteLine(I_m_nullable_int == I_m_another_nullable_int); //Also here should probably go enum //enum is a bultin enumeration type //Common use for enum is to give meaningful names to hardcoded list of numbers int a = 1; Console.WriteLine(a == (int)MyTypes.FirstType); //Ok, good enough for a first mini-lesson! } public static void MutateString(string s) { s = "Mutated"; } public enum MyTypes : int { FirstType = 1, SecondType = 2 } } }
run
|
edit
|
history
|
help
0
Problem 5 SingleDigit
10
Split and Join
sadxasxd
⁸
różne wersje parsowania kwoty i daty (CultureInfo)
adxsadxcasxsd
Binary Hex Decimal Systems
first
Hello