2 using System
.Collections
.Generic
;
4 public delegate R Fun
<A1
,R
>(A1 x
);
7 public static void Main(String
[] args
) {
8 foreach (Object d
in Map
<int,int,String
,Object
>
9 (delegate (int x
) { return x.ToString(); }
,
14 // Map with argument/result co/contravariance:
15 // Aa=argument, Rr=result, Af=f's argument, Rf=f's result
17 public static IEnumerable
<Rr
> Map
<Aa
,Af
,Rf
,Rr
>(Fun
<Af
,Rf
> f
,
23 yield return f(x
); // gmcs 1.1.9 bug: cannot convert Aa to Af
26 // FromTo : int * int -> int stream
28 public static IEnumerable
<int> FromTo(int from, int to
) {
29 for (int i
=from; i
<=to
; i
++)