-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
77 lines (49 loc) · 2.66 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Console.ReadKey(); does not wait for user to click enter, it reads any key
if you dont want the letter or key pressed to appear on the screen you should use
Console.ReadKey(true);
Console.BackgroundColor = ConsoleColor.Yellow; sets the background color to yellow
Console.Clear(); // wipes out all on screen text and changes entire bg color
Console.Title = "hello i am king"; // changes the text in the terminals title area
Console.Beep(440, 1000); frequency, duration in milliseconds, you can use console beep to play a melody.
Switch expression example
string item = itemNumber switch
{
1 => "Rope",
2 => "Torches",
3 => "Climbing Equipment",
4 => "Clean Water",
5 => "Machete",
6 => "Canoe",
7 => "Food Supplies",
_ => "Invalid Choice"
};
range operator ..
^ operator lets you index from the end of an array
re-read memory management 123 knowledge check memory
OOP !!!
We split our program into multiple components called objects - objects work together to solve the overall problem
objects contain variables and methods - most objects have a few of each
every object belongs to a specific class or type
an objects class determines the objects "shape"
all objects of the same class have the same data elements and methods, you can think of classes as catagories;
everything in a class is similar in nature and structure
objects of a particular class are often called instances of the class
** Use the right type for everything you create. if the right type doesnt exist, create it first.
enumeration , enumerate - to list things off one by one,
how to define a new "type"
the years seasons are a great way to utilize enumeration
enum Season { Winter, Spring, Summer, Fall }
ENUMERATION EXAMPLE: Simulas Test
Tuples - review This
Classes --------------------------
encapsulation - bundle together data and the operations on that data into a well defined cohesive unit
constructors - special methods that run when an object comes to life to ensure it begins in a good state.
constructors must use the same name as the class and they cannot list a return type. Otherwise, they
are essentially the same as any other method.
this keyword - special variable that always refers to the object you are in
review chapters 16-18 and re-do the challenges, also review different ways to structure switch statements
Dictionaries - like a real-life dictionary, but instead of words and their definitions,
it holds pairs of related items, and helps you quickly find the second item if you know the first one.
Enumeration -----
Enum.IsDefined(typeof(BookGenre), input)
As a whole, this statement is checking whether the value of input exists in the BookGenre enumeration.