programming code, basics
|
string
|
2 bytes/char
|
|
bool
|
|
|
char
|
2 bytes
|
|
byte
|
1 byte
|
|
short
|
2 bytes
|
|
int
|
4 bytes
|
|
long
|
8 bytes
|
|
float
|
4 bytes
|
|
double
|
8 bytes
|
|
decimal
|
16 bytes
|
using System;
public class DisplaySomeMoney
[
public static void Main()
{
double someMoney = 39.45;
Console.WriteLine(someMoney);
}
[
|
+
|
Addition
|
-
|
Subtraction
|
|
*
|
Multiplication
|
/
|
Division
|
|
%
|
Remainder
|
||
|
ToBoolean()
|
to an equivalent Boolean value
|
ToInt16()
|
to a 16-bit signed integer
|
|
ToByte()
|
to an 8-bit unsigned integer
|
ToInt32()
|
to a 32-bit signed integer
|
|
ToChar()
|
to a Unicode character
|
ToInt64()
|
to a 64-bit signed integer
|
|
ToDecimal()
|
to a decimal number
|
ToString()
|
to its equivalent String representation
|
|
ToDouble()
|
to a double-precision floating-point number
|
ToUInt16()
|
to a 16-bit unsigned integer
|
|
Array.Sort(arrayName)
|
Arranges array items in ascending order
|
|
Array.Length
|
Length of the array
|
|
Array.Reverse(arrayName)
|
Reverses the order of items in an array
|
|
Array.BinarySearch(ArrayName, value)
|
Finds a requested value in a sorted array
|
double[] sales = new double[20];sales[0] = 2100.00;sales[1] = 3256.06;Console.WriteLine(sales[1]);for (int i = 0; i < nameArray.Length; i++){ if (nameArray[i] == dwarfName) { do something* }}|
One-dimensional or single-dimensional array
|
Picture as a column of values. Elements can be accessed using a single subscript
|
|
Multidimensional arrays
|
Require multiple subscripts to access the array elements
|
If (age >= 0 && age < 120) if (a == 1 || b+c > 3)|
DateTime(yr, mo,day)
|
currdt.AddDays(1)
|
|
DateTime(yr, mo,day, hr, min, sec)
|
currdt.SubtractDays(1)
|
|
DateTime.Parse("1/1/2015")
|
TimeSpan(hrs,min,sec)
|
|
DateTime.Now
|
TimeSpan.FromSeconds(120)
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.