Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/26

Click to flip

26 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
What is the shorthand notation for Nullable?
shorthand:
int? i = 10;
normal:
Nullable<int> i = 10;
Describe the steps how to create a delegate and an eventhandler in a class and how to subscribe to it. Explain what the signature is!
1. Create a delegate object
public void delegate MyEvent(string myParam);
2. Create an event for that delegate
private MyEvent myEventHandler; -- no paranthesis!

3. Fire the event but check if the event is not null. This happens when there are no subscribers.
if (myEventHandler != null) myEventHandler("the string parameter").
4. Subscribe to the event
myClass.MyEvent += MyClass.MyEvent(myMethod);

The signature is the return value and the parameter a method has. Only methods with the same signature can subribe to an event
1. How is the event fired?
What are partial classes?
Classes which are shared between several files. They have full body declaration.
What about the declaration?
What is widening conversion?
int -> double
Implicit
What is narrowing conversion?
double to int
explicit
What is boxing?
Value type to reference type
What is unboxing?
Reference type to value type
Why to avoid boxing?
Overhead.
Boxing is a mechanism to convert a value type to a reference type. Value types are stored on the stack, but reference types are allocated on the managed heap. In order for a value type to be used as an object, the runtime must allocate memory on the heap. The value type is then copied from the stack to the heap
What to bey when using structures regarding to boxing?
Overide the virual functions ToString(), Equals, GetHash as they use boxing
3 methods to override
What is the "as" operator and what is the difference between normal casting (int)?
What exception is thrown?
Ordinaly .NET throws an InvalidCastException but with the "as" operator you get a null value back and NO exception
How to verify that a drive exist and if it's a fixed type?
DriveInfo di = new DriveInfo(@"z:\");
if (di.DriveType == DriveType.Fixed)
{
//
}
What is an ArrayList?
An unordered container for objects of any type
value types us BOXING!
What are the 2 sequential lists?
List the 3 methods for the two lists!
Queue FIFO -
Dequeue - retrieves and removes from the beginning
Enqueue - Adds an item at the end
Peek - retrieves the first without removing


Stack LIFO
List the 3 methods for the Queue class
Dequeue - retrieves and removes from the beginning
Enqueue - Adds an item at the end
Peek - retrieves the first without removing
List the 3 methods for the Stack class
Pop - retrieves and removes
Push - Adds on the top
Peek - retrieves without removing
What are Dictionaries?
Collections that map a key to value
What is the Hashtable and how is it sorted?
DictonaryEntry stores key and value.
It is sorted by the HashCode of the keys. If it finds the same key then it calls the Object.Equals method
What is the IEqualityComparer and how is it used?
Interface with 2 Methods
-GetHashCode()
-Equals()
Create a class with this interface and pass it in the constructor of a collection that supports it
What is the SortedList?
A DictonaryClass that is sorted by the key. Index changes after sorting
Name 2 Collections for Bits
BitArray and BitVector32
Describe the BitVector32
Not resizable -> stores in 32 bit integer
Used via masks and sections
Create and use a BitVector32
BitVector32 b = new BitVector32();
// Create the mask
int firstBit = BitVector32.CreateMask();
int secondBot = BitVector32.CreateMask(firstBit);
What is BitPacking?
Taking several smaller numbers and packing them into one large number. Use of Sections
How to create section in a BitVector?
BitVector32.Section firstSection = new BitVector32.CreateSection(12);
BitVector.Section = new BtVector32.CreateSection(secondSection );
BitVector32 packedBits = new////popoipoipoipo
Name two string collection classes
StringCollection which is like a ArraList only for strings

StringDictionary is like a HashTable whereby only strings are allowed for key and value

no casting for strings
What are the two Helpermethods for creating case insensitive collections?
CollectionsUtil.CreateCaseInsensitive HashTable
CollectionsUtil.CreateCaseInsensitive SortedList