C# Object Model Flashcards
- IDE
- UI
- UWP
- XML
- XAML
- Integrated Development Environment
- User Interface
- Universal Windows Platform
- Extensible Markup Language
- Extensible Application Markup Language
Assemblies
- Libraries of compiled code
- Located in the References folder
- //
- (/*) and (*/)
- Comments
- Comments on multiple lines. Opening and closing statements
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
Using directives that refer to namespaces
using Windows.UI.Popups;
Contains the MessageDialog class
- Syntax
- Semantics
- Relates to format and construction
- Relates to what statements do
Message Box
Console.WriteLine();
- Assign a value to a float variable
- Assign a value to a long variable
- Assign a value to a decimal variable
- Add F after the value
- Add L after the value
- Add M after the value
- Convert a string value to an integer
- Convert a string value to a double
- Convert a numeric value to a string
- Int.Parse();
- Double.Parse();
- ToString();
String Interpolation
- $”String1 {String2}”
- $”{String1}{String2}”
- Remainder (Modulus) operator
- Not operator
- Equality operator
- And operator
- OR operator
- %
- !
- ==
- &&
- ||
Associativity
- *, / → left to right
- = → right to left
Void
Does not return a value
Cause immediate exit from a void method
Write return; with no expression
Expression-bodied method
- Methods with a single line of code
- Example: void showResult(int answer) => Console.Writeline($”The answer is {answer}”);
C# term for variable defined by a class
Field
In a method, you must declare a variable before you can use it
In a class, you can declare a field can be declared after the statements that require it
Optional parameters
Simply assign them a default value
Short circuiting
- When the first expression of a && statement is false
- When the first expression of a || statement is true
Switch allowed variables
Int, char and string variables
SystemException
- FormatException
- OverflowException
Exception filters
Example:
catch (Exception e) when (e.GetType() != typeof(System.OutOfMemoryException))
Refer to the minimum or maximum value of and int
- int.MinValue
- int.MaxValue
Integer arithmetic overflow checking (int or long)
- checked
- {…
- }
- unchecked
- {…
- }