[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mcs / tests / dtest-error-02.cs
blobb0c186b8ebe77a5c871e1dfd9b773c1f6fdaae82
1 using System;
2 using Microsoft.CSharp.RuntimeBinder;
4 class A
6 private class N
8 public void Foo ()
12 public int Property { get; set; }
14 string this [int index] {
15 get {
16 return "x";
21 public static dynamic Factory ()
23 return new N ();
27 public class Test
29 public static int Main ()
31 dynamic d = A.Factory ();
33 try {
34 d.Foo ();
35 return 1;
36 } catch (RuntimeBinderException e) {
37 if (e.Message != "'object' does not contain a definition for 'Foo'")
38 return 2;
41 try {
42 var x = d.Property;
43 return 3;
44 } catch (RuntimeBinderException e) {
45 if (e.Message != "'object' does not contain a definition for 'Property'")
46 return 4;
49 try {
50 var x = d [4];
51 return 5;
52 } catch (RuntimeBinderException e) {
53 if (e.Message != "Cannot apply indexing with [] to an expression of type 'object'")
54 return 6;
57 return 0;