C# Flashcards
True or false: You can convert a bool to an int
False
Which type of object holds the actual data?
Value
Which type of object holds only a reference to the data?
Reference
How do you create a nullable value type?
Appending a ? to the
What can you do to reduce the amount of code you have to write when using a namespace?
Add the using keyword with the namespace as a top-level statement.
Can an abstract class be instantiated?
No
What makes a record different from a class is that the equality between objects means…
All of the types, properties and field values match.
Equality between two class objects means…
The two objects are the same object.
C# does not allow multiple inheritance. What can you use to mimic that behavior?
Interface
C# delegates is what and how do they compare to JS callbacks?
It is a type that stores a function pointer. It can be used to create callbacks but is not its only function.
Converting from a value type to a reference type is called…and conversion is…
Boxing
Converting from a reference type to a value type is called…and conversion is…
Unboxing explicit conversion (cast)
The main difference between string and stringbuilder is what? When would you use one over the other?
if a string is changed it creates a new instance whereas stringbuilder modifies the same instance. Use stringbuilder when performance is favored. (Large loops)
What is a sealed class?
A class that can not be inherited from.
What is a partial class?
A class that is defined into segmented parts within the same file or different files.