Lecture overview -- Keyboard shortcut: 'u'  Previous page: Variance -- Keyboard shortcut: 'p'  Next page: Generic interfaces: IComparable<T> -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 13 : 21
Object-oriented Programming in C#
Generic Types and Methods
Generic structs

Generic structs are very similar to generic classes

We use the generic struct Nullable<T> as an example

 

  • Struct Nullable<T>

    • The type T? serves as a convenient alias of Nullable<T>

    • The generic type Nullable<T> enjoys additional special support by the C# compiler

      • Lifted operators

/user/normark/oop-csharp-1/sources/c-sharp/generics/nullable/nullable.csA partial reproduction of struct Nullable<T>.