1 // Experiment: implicit conversion of indexer to function
2 // sestoft@dina.kvl.dk * 2005-11-08
8 public static void Main(String
[] args
) {
9 FooBar fb
= new FooBar();
10 IList
<int> list
= new LinkedList
<int>();
11 list
.AddAll(new int[] { 2, 3, 5, 7, 11 }
);
12 list
.Map
<double>(fb
).Apply(Console
.WriteLine
);
18 public double this[int x
] {
25 public Fun
<int,double> Fun
{
27 return delegate(int x
) { return this[x]; }
;
33 return delegate(int x
) { double junk = this[x]; }
;
37 public static implicit operator Fun
<int,double>(FooBar fb
) {
38 return delegate(int x
) { return fb[x]; }
;
41 public static implicit operator Act
<int>(FooBar fb
) {
42 return delegate(int x
) { double junk = fb[x]; }
;