Assignment

We’ve used assignment repeatedly already. It’s simply a way to assign a value to a variable (or property, indexer or event, to be precise). For example:

// Assigning to a local variable, declared elsewhere.person = new Person("Bart", 26);// Assigning to a property through a setter.person.DayOfBirth = new DateTime(1983, 2, 11);

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.