C# Flashcards
What does async and await mean?
They are code markers, that tell us where the application should continue once the task is complete.
Await, wait here until this line of code is complete.
In a synchronous application if code is blocked then the entire application waits which takes more time.
What is MVC?
It’s an architectural design pattern that separates an application into three main logical components; Model, View, Controller.
What are access modifiers/ specifiers?
They’re accessibility levels, all types and members have accessibility levels, they control whether they can be used from other code in the assembly or other assemblies.
What are all the types of access modifiers?
Public Private Internal Protected Protected Internal
What is a public and private access modifier?
Private members are available only within the containing type whereas public members are available anywhere. There’s no restriction for public members.
What is a protected access modifier?
Protecting members are available within the containing type and to the types that are derived from the containing type.
What is an internal access modifier?
Internal access modifiers are available anywhere within the containing assembly.
What is a protected internal access modifiers?
Can be accessed anywhere within the assembly in which it is declared or form within a derived class in another assembly. It is a combination of protected and internal.
What are namespaces and why do we use them?
They’re used to organize code into logical groups and to prevent name collisions that can occur especially when your code base includes multiple libraries.
What are constructors?
Constructors are special types of methods of a class that automatically get executed whenever we create an instance (object) of that class. The constructors are responsible for two things. Object initialization and memory allocation.
Note: The constructor name must match the class name and it cannot have a return type. The constructor is called when the object is created. All classes have constructors by default, if you do not create a class constructor yourself, c# creates one for you. However, then you are not able to set initial values for those fields.
What is dependency injection?
Its a design pattern where an object receives other objects that it depends on.
Why do we use dependency injection?
Makes our code more maintainable.
What is a class?
Can be described as the blueprint of a specific object. The class is a blueprint from which the individual objects are created.
What is an object?
An object is an instance of a class. Can be considered as a thing that can perform activities. The set of activities that the object performs defines the object’s behavior.
What is an abstract class?
A special type of class that can be instantiated. It’s designed to be inherited by subclasses. The subclass must override its method.