Value types

Value types

 A popular question that often comes up in job interviews is: "what is the difference between a value type and a reference type?" 

 This lecture looks at value types in detail. What are value types, how do they store their data, and what happens when value types are assigned or compared? After completing this lecture you will be able to answer all of these questions with ease. 


Write High Performance C# Code

Buy nowLearn more

Introduction

  • Course introduction
  • Introduction to code optimization
  • Windows, OS/X or Linux?

Fundamentals of the .NET Framework

  • Section introduction
  • Quiz 1: The Stack
  • The Stack
  • Quiz 2: The Heap
  • The Heap
  • Value types
  • Value types
  • Reference types
  • Reference types
  • Boxing and unboxing
  • Boxing and unboxing
  • Immutable strings
  • Immutable strings
  • Section recap

A crash course in Intermediate Language

  • Section introduction
  • Common Intermediate Language
  • Section recap
  • Common Intermediate Language

Basic optimizations: the low-hanging fruit

  • Section introduction
  • How to prevent boxing and unboxing
  • Fast string concatenation
  • Fast collections
  • Fast arrays
  • Throwing and catching exceptions
  • For versus Foreach
  • Section Recap
  • Basic optimizations

Intermediate optimizations

  • Section introduction
  • Fast Garbage Collection - part 1
  • Fast Garbage Collection - part 2
  • Fast delegates
  • Fast class factories
  • Section recap
  • Intermediate optimizations

Advanced optimizations

  • Section introduction
  • Arrays on the stack
  • Pointers - part 1
  • Pointers - part 2
  • Background Info - Modifying String Constants
  • Section recap
  • Advanced optimizations

Final words

  • Course recap