Pash-Project/Pash — pull request #158 by mrward (2013-10-01 20:37:29+00:00)
Title: Implement += assignment.

Supports the following:

$i = 0;
$i += 10;

$x = 'a';
$x += 'bcdef';

Implementation uses dynamic to add two objects together which seems simpler than using reflection or casting.

It looks like PowerShell is not using dynamic. Trying to add two System.Objects together from the PowerShell command line results in the error:

Method invocation failed because [System.Object] doesn't contain a method named 'op_Addition'.

So it looks like PowerShell is using reflection for some types and probably handles types such as integers, which have no op_Addition method, individually by casting them to the correct type.