Study FSP Flashcards
(70 cards)
Polymorphism
It means that different objects can be used in the same way.
Example: Imagine a base class called Animal with a method called Speak(). A Dog class and a Cat class both inherit from Animal and each has its own version of Speak(). When you call Speak() on an animal, the correct version (bark or meow) is used.
Abstraction
Abstraction is about hiding complex details and showing only the important parts.
Example: You can think of a Vehicle where you only see the basic controls (start, stop) without knowing how the engine works inside.
Value Type
These are simple data types (like numbers or small structures) that hold their value directly. For example, an int variable stores a number directly.
Reference Type
These types (like classes and arrays) store a reference to the data, not the data itself. Imagine it as an address that tells you where the data is kept in memory.
Class
Is a reference type. It supports inheritance (one class can be based on another) and is stored in a shared area of memory (heap).
Struct
Is a value type. It is often used for small, simple pieces of data and is stored directly (on the stack).
Array
Has a fixed size, meaning once you create it, you cannot change its length.
List
Can grow or shrink as you add or remove items, and it has many helpful methods (like adding or removing items).
Interface
It only tells what methods a class should have but doesn’t include any code.
Abstract class
Can have some code already written (and can include data) while still requiring some methods to be implemented by its child classes.
Boxing
Converting a simple type (like an int) into an object so it can be used as a reference type.
Unboxing
Getting the simple type back from the object.
Generics
Generics let you create classes or methods that can work with any data type.
Example: List can be a list of integers (List) or strings (List) without writing separate classes for each type.
Extension Methods
This feature lets you add new methods to an existing type without changing its original code.
Example: You can add a method ToTitleCase() to the string type so that you can call it like this:
“hello world”.ToTitleCase();
This new method might change the string to “Hello World”.
Delegate and Types of Delegates
A delegate is like a pointer to a method, allowing you to pass methods as parameters.
Single-cast delegate
Points to one method.
Multicast delegate
Can point to several methods.
Reflection
Reflection lets you look at the details of your code while it is running.
Example: You can ask a class “What properties do you have?” and get the answer even if you did not write that information explicitly.
IEnumerable
It’s used to iterate through a collection (like a list or array) in memory.
It works with any data that is already loaded.
It does not support database operations directly.
Executes queries immediately (when the loop starts).
List<int> numbers = new List<int> { 1, 2, 3, 4 };
IEnumerable<int> even = numbers.Where(n => n % 2 == 0);</int></int></int>
IQueryable
It’s designed for querying data from a database (like with Entity Framework).
It builds an expression tree and translates it into a SQL query.
Executes the query only when you use the data (e.g., with ToList()).
More efficient for database queries because the filter happens on the server, not in memory.
IQueryable<User> users = dbContext.Users.Where(u => u.Age > 18);</User>
Parallel Programming
Runs several tasks at the same time, often on different CPU cores, to finish work faster.
Async Programming
Lets your program do other things while waiting for a long task (like reading a file or a web call).
POST
Usually used to create a new resource (like adding a new record).
PUT
Used to update an existing resource completely.