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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.