Member Access

One thing we’ve been dealing with all the time without giving it explicit attention is the concept of member access, indicated by the period (.) token:

Console.WriteLine("Hello");person.Age = 26;placeOrder.Click += placeOrder_Click;

Here we’re respectively looking up a method, a property, and an event using the member access. Members are what types consist of and are accessible either through the type itself (as in the first case, called a static method) or through a type’s instances (as in the latter two cases). Fields can be accessed in a similar way.

Note: Generics

Sometimes member access is paired with the specification of type arguments in the context of generics. A method itself may need a type argument, which is specified ...

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.