Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-063.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 70486e88bb8e2b79498f878091197d7eaeeb5918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;

public class Test
{
	public static int IndexOf (Array array, object value)
	{
		// This is picking the non-generic version.
		return IndexOf (array, value, 0, array.Length);
	}

	public static int IndexOf (Array array, object value, int startIndex, int count)
	{
		return 2;
	}

	public static int IndexOf<T> (T[] array, T value, int startIndex, int count)
	{
		return 1;
	}
}

class X
{
	public static int Main ()
	{
		Test test = new Test ();
		string[] array = new string [] { "Hello" };

		int result = Test.IndexOf (array, array);
		if (result != 2)
			return 1;

		string hello = "Hello World";
		// This is picking the generic version.
		result = Test.IndexOf (array, hello, 1, 2);
		if (result != 1)
			return 2;

		return 0;
	}
}