Question: I'd be interested in some before-and-after c# examples, some non-idiomatic vs idiomatic examples. Non-c# examples would be fine as well if they get the idea across. Thanks.

Answer: 
Some examples:

**Resource management**, non idiomatic:

```
string content;
StreamReader sr = null;
try {
    File.OpenText(path);
    content = sr.ReadToEnd();
}
finally {
    if (sr != null) {
        sr.Close();
    }
}

```

Idiomatic:

```
string content;
using (StreamReader sr = File.OpenText(path)) {
    content = sr.ReadToEnd();
}

```

**Iteration**, non idiomatic:

```
for (int i=0;i<list.Count; i++) {
   DoSomething(list[i]);
}

```

Also non-idiomatic:

```
IEnumerator e = list.GetEnumerator();
do {
   DoSomenthing(e.Current);
} while (e.MoveNext());

```

Idiomatic:

```
foreach (Item item in list) {
   DoSomething(item);
}

```

**Filtering**, non-idiomatic:

```
List<int> list2 = new List<int>();
for (int num in list1) {
  if (num>100) list2.Add(num);
}

```

idiomatic:

```
var list2 = list1.Where(num=>num>100);

```
In PHP I sometimes encounter code like:

```
foreach ($array as $value) {
    $trimmed[] = trim($value);
}
return $trimmed;

```

Which idiomatically can be implemented with:

```
return array_map('trim', $array);

```