Merge pull request #5210 from alexrp/profiler-runtime-settings
[mono.git] / mono / tests / reflection.cs
1 using System.Reflection;
2 using System.Collections;
3 using System;
4
5 namespace Test {
6         internal class CM : IComparer {
7                 public int Compare (object x, object y) {
8                         return ((MethodInfo)x).Name.CompareTo (((MethodInfo)y).Name);
9                 }
10         }
11         public class T {
12                 public static int Main(string[] args) {
13                         string[] names = {
14                                 "Equals", "Equals",
15                                 "GetHashCode", "GetType",
16                                 "ReferenceEquals", "ToString"
17                         };
18                         int i;
19                         string name = "System.Object";
20                         if (args.Length > 0)
21                                 name = args [0];
22                         Type t = Type.GetType (name, true);
23                         MethodInfo[] ms = t.GetMethods();
24
25                         Array.Sort (ms, new CM());
26                         foreach (MethodInfo m in ms) {
27                                 Console.WriteLine (m.ReturnType.Name + " " + m.Name);
28                         }
29                         if (name == "System.Object") {
30                                 for (i=0; i < names.Length; ++i)
31                                         if (names [i] != ms [i].Name)
32                                                 return i + 1;
33                         }
34                         return 0;
35                 }
36         }
37 }