As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func.
Today, we have to do something like this:
Class MyClass {
[int] Add47([int] $value) {
return 47 + $value
}
[int] DoStuff([System.Collections.Generic.IEnumerable[int]] $collection) {
# ugly
$func = $this.GetType().GetMethod("Add47").CreateDelegate([Func[int,int]], $this)
return [Linq.Enumerable]::Sum($collection, $func)
}
}
I would like to express that as:
Class MyClass {
[int] Add47([int] $value) {
return 47 + $value
}
[int] DoStuff([System.Collections.Generic.IEnumerable[int]] $collection) {
return [Linq.Enumerable]::Sum($collection, $this.Add47)
}
}
What is the right place to do this?
As a step on the way to realize #2226, I think we should start with adding a conversion from PSMethodInfo to System.Func.
Today, we have to do something like this:
I would like to express that as:
What is the right place to do this?