[System] Tweak socket test
[mono-project.git] / mono / tests / bug-562150.cs
blob1a543877a93b5924e1c5c3bdfbd9e0676393d8d8
2 using System;
3 using System.ComponentModel;
4 using System.Diagnostics;
6 namespace Application
8 public sealed class FooClass<S> where S : class
10 public static FooClass<S> Create(string name, Action<S> action)
12 return new FooClass<S>(name, action);
15 public static FooClass<S> Create<T>(S source, string name,
16 Func<S, T> func, FooClass<T> fooChild)
17 where T : class
19 return new FooClass<S>(source, name, CreateCallback(func, fooChild));
22 private static Action<S> CreateCallback<T>(
23 Func<S, T> func, FooClass<T> fooChild)
24 where T : class
26 return delegate(S source)
31 private FooClass(string name, Action<S> action)
33 m_name = name;
34 m_action = action;
37 private FooClass(S source, string name, Action<S> action)
38 : this(name, action)
40 m_source = source;
43 S m_source;
44 readonly string m_name;
45 Action<S> m_action;
48 public class MyClass
50 public int Value { get; set; }
51 public MyClass Child { get; set; }
54 public class VarCompilerTest
57 public static void Main(string[] args)
59 MyClass obj = new MyClass();
60 int nCalls = 0;
61 FooClass<MyClass> fooChild = FooClass<MyClass>.Create("Value", delegate { nCalls++; });
62 FooClass<MyClass>.Create(obj, "Child", x => x.Child, fooChild);