[xbuild] Fix BuildItem.GetMetadata() and TaskItem.GetMetadata ()

This change makes those functions behave like their equivalents in .NET.
All tests related with the affected code have passed on my machine.

The attached image illustrate the results from test runs of these functions
with various inputs on .NET.

![builditemmetadatamatrix](https://f.cloud.github.com/assets/759436/1969096/8d3f4d54-82ed-11e3-80b3-5670b15faeb7.png)

This PR replaces https://github.com/mono/mono/pull/877