Basic

Glossary

Private fields: 
Can only be accessed by methods in the class (via getter and setter) and 
they are not accessible by subclasses or instantiation.

Protected fields:
Can only be accessed by methods in the class and by subclasses.

Read-only fields:
Set at runtime at constructors and can't be changed.

Method overloading:
When you have different versions of method 

Method override:
when you replace a method

Generic can only store one type
Non generic can store many types

TryGetValue

Verbatim String

Null

Casting

Pass by Value vs Pass by Reference

Params Modifier

Array

Exception Handler - Prevent program from exiting and handle the error

Constructor

Getter and Setter

Static - Class Static Attribute and Static Method and Static Class

Inner Class

Inheritance - Is-A relationship (Dog Class is Animal Class)

Aggregation or Delegate - Has-A relationship (Animal Class has a Animal Id Info Class)

Polymorphism

List, Dictionary, Tuple

Enum

Interface

Interface is like a contract... Why not use base class? Because you can derive from multiple interfaces

Generics

Handle unknown data types

Dependency Injection - Add Singleton, Add Scoped and Add Transient

Service Type

In the scope of a given HTTP request

Across different HTTP request

Scoped Service

Same Instance

New Instance

Singleton Service

Same Instance

Same Instance

Transient Service

New Instance

New Instance

Defensive Programming - Mosh

Different type of access modifier: private, public, protected and internal. Link

Last updated

Was this helpful?