IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
SymbolExtensions.cs
Go to the documentation of this file.
1using System;
2
6
7#if IMPORTER || EXPORTER
9
10using Type = IKVM.Reflection.Type;
11#else
12using System.Reflection;
13#endif
14
15namespace IKVM.Runtime
16{
17
18 static class SymbolExtensions
19 {
20
21 public static Assembly AsReflection(this IAssemblySymbol symbol)
22 {
23 if (symbol == null)
24 return null;
25
26#if IMPORTER || EXPORTER
27 return ((IkvmReflectionAssemblySymbol)symbol).UnderlyingAssembly;
28#else
29 return ((ReflectionAssemblySymbol)symbol).UnderlyingAssembly;
30#endif
31 }
32
33 public static Type AsReflection(this ITypeSymbol symbol)
34 {
35 if (symbol == null)
36 return null;
37
38#if IMPORTER || EXPORTER
39 return ((IkvmReflectionTypeSymbol)symbol).UnderlyingType;
40#else
41 return ((ReflectionTypeSymbol)symbol).UnderlyingType;
42#endif
43 }
44
46 {
47 if (symbol == null)
48 return null;
49
50#if IMPORTER || EXPORTER
51 return ((IkvmReflectionConstructorSymbol)symbol).UnderlyingConstructor;
52#else
53 return ((ReflectionConstructorSymbol)symbol).UnderlyingConstructor;
54#endif
55 }
56
57 public static MethodInfo AsReflection(this IMethodSymbol symbol)
58 {
59 if (symbol == null)
60 return null;
61
62#if IMPORTER || EXPORTER
63 return ((IkvmReflectionMethodSymbol)symbol).UnderlyingMethod;
64#else
65 return ((ReflectionMethodSymbol)symbol).UnderlyingMethod;
66#endif
67 }
68
69 public static FieldInfo AsReflection(this IFieldSymbol symbol)
70 {
71 if (symbol == null)
72 return null;
73
74#if IMPORTER || EXPORTER
75 return ((IkvmReflectionFieldSymbol)symbol).UnderlyingField;
76#else
77 return ((ReflectionFieldSymbol)symbol).UnderlyingField;
78#endif
79 }
80
81 public static PropertyInfo AsReflection(this IPropertySymbol symbol)
82 {
83 if (symbol == null)
84 return null;
85
86#if IMPORTER || EXPORTER
87 return ((IkvmReflectionPropertySymbol)symbol).UnderlyingProperty;
88#else
89 return ((ReflectionPropertySymbol)symbol).UnderlyingProperty;
90#endif
91 }
92
93 }
94
95}
IKVM.Reflection.Type Type
IKVM.Reflection.Assembly Assembly
IKVM.Reflection.ConstructorInfo ConstructorInfo
IKVM.Reflection.FieldInfo FieldInfo
IKVM.Reflection.PropertyInfo PropertyInfo
IKVM.Reflection.MethodInfo MethodInfo
static PropertyInfo AsReflection(this IPropertySymbol symbol)
static MethodInfo AsReflection(this IMethodSymbol symbol)
static Assembly AsReflection(this IAssemblySymbol symbol)
static Type AsReflection(this ITypeSymbol symbol)
static FieldInfo AsReflection(this IFieldSymbol symbol)
static ConstructorInfo AsReflection(this IConstructorSymbol symbol)
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Discovers the attributes of a class constructor and provides access to constructor metadata.
Discovers the attributes of a field and provides access to field metadata.
Discovers the attributes of a method and provides access to method metadata.
Discovers the attributes of a property and provides access to property metadata.
Represents type declarations: class types, interface types, array types, value types,...