3.6: Types

In this module we'll talk about Value Types, DateTimeOffset, and Reference Types.

Value Types Review

  • DateTimeOffset is a value type, they can't be null.

  • Adding the ? to ModifiedUtc allows a value type to be null.

  • It's good to store dates with DateTimeOffset, this way it will account for time zones.

  • We will format the date & time in Part 11.

Important:

  • Let's say it again: Notice the ? after the DateTimeOffset for the ModifiedUtc. This allows the value type to be null. The ? is referred to as the null-conditional operator. Just making sure you caught that!

Reference Types

Just for the sake of review let's note something important:

  • Objects are reference types, they can be null.

  • Reference Types point to an address in memory.

Just a little review.

Last updated