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

36 lines
643 B
C#

using System;
static class SimpleTest
{
public static string Prefix (this string s, string prefix)
{
return prefix + s;
}
}
public class M
{
public static int Main ()
{
SimpleTest.Prefix ("foo", "1");
string s = "foo".Prefix ("1");
Type ex_attr = typeof (System.Runtime.CompilerServices.ExtensionAttribute);
if (!typeof (SimpleTest).IsDefined (ex_attr, false))
return 1;
if (!typeof (SimpleTest).Assembly.IsDefined (ex_attr, false))
return 2;
if (!typeof (SimpleTest).GetMethod ("Prefix").IsDefined (ex_attr, false))
return 3;
if (s != "1foo")
return 9;
Console.WriteLine (s);
return 0;
}
}