Skip to content

Instantly share code, notes, and snippets.

@petterek
petterek / Transformers.vb
Created May 8, 2012 11:14
Transform and do an action on a enurable(Of )
Public Class Transformers
Public Shared Function OptimusPrime(Of T, TT As {New})(incol As IEnumerable(Of T), comp As Comparer(Of T, TT), action As Action(Of TT, T)) As IEnumerable(Of TT)
Dim ret As New List(Of TT)
For Each p In incol
Dim curP = p
Dim cur = ret.Find(Function(o) comp(curP, o))
If cur Is Nothing Then