linux-packaging-mono/mcs/tests/gtest-optional-04.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

69 lines
941 B
C#

using System;
public struct S
{
}
public class C
{
static void Foo<T> (T t, T u = default (T))
{
}
static void TestParams (params int[] i)
{
throw new ApplicationException ();
}
static void TestParams (int i = 4)
{
}
static void TestParams2 (string s, params int[] i)
{
throw new ApplicationException ();
}
static void TestParams2 (string s, int i = 4)
{
}
static void TestStruct (int? s = new int ())
{
if (!s.HasValue)
throw new ApplicationException ("TestStruct");
}
static void TestStruct2 (S? s = new S? ())
{
}
public string this [int i, string s = "test"] {
get { return s; }
set { value = s; }
}
public static int Main ()
{
Foo ("f");
Foo (2);
Foo (2, 4);
Foo<long> (2);
Foo<string> ("2", "3");
TestParams ();
TestParams2 ("a");
TestStruct ();
TestStruct2 ();
C c = new C ();
if (c [1] != "test")
return 1;
c [3] = "value";
return 0;
}
}