Lecture overview -- Keyboard shortcut: 'u'  Previous page: Value types -- Keyboard shortcut: 'p'  Next page: Structs in C# -- 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 9 : 29
Object-oriented Programming in C#
Reference types, Value types, and Patterns
Illustration of variables of value types

This page illustrates assignment on value types, in the same way as done for reference types on an earlier page.

Assume that the type Point is a value type

Variables of value types. The situation before the assignment p1 = p2.

Point p1 = new Point(1.0, 2.0),
      p2 = new Point(3.0, 4.0);

p1 = p2;

The variables p1 and p2 refer to two points. p1 is assigned to p2.

Variables of value types. The situation after the assignment p1 = p2.