Boo vs. PowerShell
Oren (Ayende) wrote a cool little script in Boo showing how to count the number of types and methods in mscorlib. Just for fun, here's an equivalent script in PowerShell that does the same thing:
$typeCount++
$methodCount += $_.GetMethods().Length
}
"Types $typeCount, Methods $methodCount"
This is, of course, just one possible way to write it.






[System.Object].Assembly.GetTypes() | %{$_.GetMethods().Length} | measure-object -sum
I just picked up powershell today, I’m hooked!
[System.Object].Assembly.GetTypes() | foreach {
$_.Name; $_.GetMethods() | foreach{"-==-"+$_.Name}
}
"Types $typeCount, Methods $methodCount"