.NET and C# Flashcards
What is .NET?
.NET is a platform created by Microsoft which can be used to create various applications for example mobile, web or desktop applications in multiple languages such as C#, F# and VB.
What is .NET Framework?
.NET Framework is a framework for building desktop and web applications. It does not support cross-platform and will only run on windows.
What is .NET Core / .NET 5/6?
.NET Core (Now called .NET 5/6) is an open source cross platform framework for building applications and it can run on any platform such as Windows, Mac or Linux.
What is .NET standard?
.NET Standard is used to create libraries that can be shared and accessed by both .NET Framework and .NET Core projects.
What is a value type?
What is a reference type?
Data types are categorised based on how they store their value in memory.
Value Type - Variables of value Type directly contain their data. When a value type is created a single space in stack memory is allocated to store the value. Value types include, int, float, decimal, double, bool, enum.
Reference Type - Variables of reference type store a reference (address) to their data. A reference type is stored in heap memory and the reference address is stored in the stack. Reference types include strings, classes, arrays, lists.
Explain the public access modifier
Public - code can be accessed from anywhere
Explain the private access modifier
Private - can only be accessed from within the class
Explain the Protected access modifier
Protected - can be accessed by code in the same class or within a class that is derived from it
Explain Internal access modifier
Internal - can be accessed by code in the same class or in a derived class in the same assembly(project)
Explain protected internal access modifier
Protected Internal - can be accessed by code in the same class, another class in the assembly(project) or by a derived class in another assembly
Explain private protected access modifier
Private Protected - can be accessed by code from within the class or from a derived class in the same assembly.
What is boxing and unboxing in C#?
Boxing and Unboxing in C# allows for the conversion of data types from value types to reference types and visa versa.
Explain Boxing
Boxing is the conversion of a value type to a reference type. This is done by creating an object instance in the heap and copying over the value to the object instance.
Explain unboxing
Unboxing is the conversion of a reference type to a value type. First the object is checked to make sure the boxed value is the right value type then the value is copied from the instance into the value-type variable.
Deferred Execution vs Immediate Execution in LINQ
Deferred execution means that the query is not executed when it is declared, it is only executed when the query object is iterated over a loop. It returns a group of values. Examples of deferred (or lazy) operators include .Where and .Select
Immediate execution is when the query is executed when it is declared and returns a single value. Examples of immediate (or greedy) operators include .Count, .ToList, .ToArray and .First