I feel like an old fogey now, but I came into .NET when it was just finishing up beta, and struggled through the painful C# 1.0 period. The 2.0 revolution that added generics and so on was like a magic gift that I still somehow don't think of as having been around for a long time. Anonymous methods and even moreso the var keyword and default parameter values are like some sort of black magic to me.
Haha. Too true.
I've gotten the hang of
most of it due to having been in Javaland for a while (and in some respects, having to deal with it because Forge Said So).
But it's ungodly super awesome.
This being one of the things that Forge did that made everyone happy (once people realized what it was and how it worked):
public <T> T getCapability(Capability<T> capability, EnumFacing sideAccessed) {
//...
}
The Capability<T> bit is basically a way to say "I'm passing in a reference type, if you deal with that type, give me that object instance." No more "TileEntity MyThing implements IInventory ISidedInventory IEnergyProvider IRedPowerProvider IMechanicalSupplier IUniversalPowerAdapter...." Nope, no more "god object," it's all capabilities now.
If the object doesn't have the requested capability, return null (or rather, return super.getCapability, so you're not accidentally
skipping any provided by a super-class!). If it does, return it.