/
TypeBuilder.cs
79 lines (61 loc) · 4.97 KB
/
TypeBuilder.cs
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace System.Reflection.Emit
{
public partial class TypeBuilder : TypeInfo
{
public const int UnspecifiedTypeSize = 0;
public ConstructorBuilder DefineConstructor(MethodAttributes attributes, CallingConventions callingConvention, Type[]? parameterTypes)
=> DefineConstructor(attributes, callingConvention, parameterTypes, null, null);
public FieldBuilder DefineField(string fieldName, Type type, FieldAttributes attributes)
=> DefineField(fieldName, type, null, null, attributes);
public MethodBuilder DefineMethod(string name, MethodAttributes attributes)
=> DefineMethod(name, attributes, CallingConventions.Standard, null, null);
public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention)
=> DefineMethod(name, attributes, callingConvention, null, null);
public MethodBuilder DefineMethod(string name, MethodAttributes attributes, CallingConventions callingConvention,
Type? returnType, Type[]? parameterTypes)
=> DefineMethod(name, attributes, callingConvention, returnType, null, null, parameterTypes, null, null);
public MethodBuilder DefineMethod(string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes)
=> DefineMethod(name, attributes, CallingConventions.Standard, returnType, parameterTypes);
public TypeBuilder DefineNestedType(string name)
=> DefineNestedType(name, TypeAttributes.NestedPrivate, null, null);
public TypeBuilder DefineNestedType(string name, TypeAttributes attr)
=> DefineNestedType(name, attr, null, null);
public TypeBuilder DefineNestedType(string name, TypeAttributes attr,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent)
=> DefineNestedType(name, attr, parent, null);
public TypeBuilder DefineNestedType(string name, TypeAttributes attr,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, int typeSize)
=> DefineNestedType(name, attr, parent, PackingSize.Unspecified, typeSize);
public TypeBuilder DefineNestedType(string name, TypeAttributes attr,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packSize)
=> DefineNestedType(name, attr, parent, packSize, TypeBuilder.UnspecifiedTypeSize);
[RequiresUnreferencedCode("P/Invoke marshalling may dynamically access members that could be trimmed.")]
public MethodBuilder DefinePInvokeMethod(string name, string dllName, MethodAttributes attributes,
CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes,
CallingConvention nativeCallConv, CharSet nativeCharSet)
=> DefinePInvokeMethod(name, dllName, name, attributes, callingConvention, returnType, null, null,
parameterTypes, null, null, nativeCallConv, nativeCharSet);
[RequiresUnreferencedCode("P/Invoke marshalling may dynamically access members that could be trimmed.")]
public MethodBuilder DefinePInvokeMethod(string name, string dllName, string entryName, MethodAttributes attributes,
CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes,
CallingConvention nativeCallConv, CharSet nativeCharSet)
=> DefinePInvokeMethod(
name, dllName, entryName, attributes, callingConvention, returnType, null, null,
parameterTypes, null, null, nativeCallConv, nativeCharSet);
public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type returnType, Type[]? parameterTypes)
=> DefineProperty(name, attributes, returnType, null, null, parameterTypes, null, null);
public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes,
CallingConventions callingConvention, Type returnType, Type[]? parameterTypes)
=> DefineProperty(name, attributes, callingConvention, returnType, null, null, parameterTypes, null, null);
public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes,
Type returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
=> DefineProperty(name, attributes, default,
returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
}
}