Dynamic Operations

To finish off our overview of DynamicObject and DynamicMetaObject, we’ll take a quick look at the various operations that can be specialized by overriding a method on those base classes. Some of those operations have a C# notation, whereas others exist in dynamic languages only.

Binary operations, such as mathematical logical operators and (in)equality operators. For example, a + b, a > b, a && b.

Unary operations, such as logical negation or complement or numeric minus or plus. For example, -a, !a.

Getting and setting members, which correspond to properties or fields in CLR terms. For example, a.Foo or a.Bar = 5.

Getting and setting indexes to index into objects such as collections, vectors, and so on. For example, ...

Get C# 4.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.