-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System;
-public class Test
-{
- public delegate void DelType();
-
- public event DelType MyEvent;
-
- public static int Main()
- {
- EventInfo ei = typeof(Test).GetEvent ("MyEvent");
- MethodImplAttributes methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags();
-
- if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) {
- Console.WriteLine ("FAILED");
- return 1;
- }
+public delegate int DelType ();
- methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags();
- if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) {
- Console.WriteLine ("FAILED");
- return 2;
- }
+struct S
+{
+ public event DelType MyEvent;
+ public static event DelType MyEventStatic;
+
+ public int RunInstance ()
+ {
+ return MyEvent ();
+ }
+
+ public int RunStatic ()
+ {
+ return MyEventStatic ();
+ }
+}
- return 0;
- }
+public class Test
+{
+ public static int Main ()
+ {
+ S.MyEventStatic += delegate () { return 22; };
+ S s = new S ();
+ s.MyEvent += delegate () { return 6; };
+ if (s.RunInstance () != 6)
+ return 1;
+
+ if (s.RunStatic () != 22)
+ return 2;
+
+ return 0;
+ }
}