blob: ee369cbaf70213d261ce88e773c42fdbb51479aa (
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
42
43
44
|
using System;
using System.Reflection;
static partial class StaticClass
{
public static string Name ()
{
return "OK";
}
}
partial class StaticClass2 {}
static partial class StaticClass2 {}
public class MainClass
{
static bool IsStatic (Type t)
{
Type type = typeof (StaticClass);
if (!type.IsAbstract || !type.IsSealed) {
Console.WriteLine ("Is not abstract sealed");
return false;
}
if (type.GetConstructors ().Length > 0) {
Console.WriteLine ("Has constructor");
return false;
}
return true;
}
public static int Main ()
{
if (!IsStatic (typeof (StaticClass)))
return 1;
if (!IsStatic (typeof (StaticClass2)))
return 2;
Console.WriteLine ("OK");
return 0;
}
}
|