@@ -94,7 +94,8 @@ var newType = new TypeDefinition(
9494 " Namespace" ,
9595 " Name" ,
9696 TypeAttributes .Public ,
97- module .CorLibTypeFactory .Object );
97+ module .CorLibTypeFactory .Object
98+ );
9899```
99100
100101> [ !WARNING]
@@ -109,8 +110,7 @@ var newType = new TypeDefinition(
109110 " Namespace" ,
110111 " Name" ,
111112 TypeAttributes .Public ,
112- module .CorLibTypeFactory .CorLibScope
113- .CreateTypeReference (" System" , " ValueType" )
113+ module .CorLibTypeFactory .CorLibScope .CreateTypeReference (" System" , " ValueType" )
114114);
115115```
116116
@@ -122,7 +122,8 @@ ModuleDefinition module = ...
122122var newType = new TypeDefinition (
123123 " Namespace" ,
124124 " IName" ,
125- TypeAttributes .Public | TypeAttributes .Interface );
125+ TypeAttributes .Public | TypeAttributes .Interface
126+ );
126127```
127128
128129Once a type has been constructed, it can be added to either a ` ModuleDefinition `
@@ -193,7 +194,8 @@ ModuleDefinition module = ...;
193194var field = new FieldDefinition (
194195 " MyField" ,
195196 FieldAttributes .Public ,
196- module .CorLibTypeFactory .Int32 );"
197+ module .CorLibTypeFactory .Int32
198+ );"
197199```
198200
199201Fields can be added to a type :
@@ -294,10 +296,10 @@ var method = new MethodDefinition(
294296 " MyMethod" ,
295297 MethodAttributes .Public | MethodAttributes .Static ,
296298 MethodSignature .CreateStatic (
297- module .CorLibTypeFactory .Void , // Return type
298- module .CorLibTypeFactory .Int32 , // Parameter 1
299- module . CorLibTypeFactory . String // Parameter 2
300- ) );
299+ returnType : module .CorLibTypeFactory .Void ,
300+ parameterTypes : [ module .CorLibTypeFactory .Int32 , module . CorLibTypeFactory . String ]
301+ )
302+ );
301303```
302304
303305Similarly, for instance methods, use the ` MethodSignature.CreateInstance ` to create the signature:
@@ -308,10 +310,10 @@ var method = new MethodDefinition(
308310 " MyMethod" ,
309311 MethodAttributes .Public ,
310312 MethodSignature .CreateInstance (
311- module .CorLibTypeFactory .Void , // Return type
312- module .CorLibTypeFactory .Int32 , // Parameter 1
313- module . CorLibTypeFactory . String // Parameter 2
314- ) );
313+ returnType : module .CorLibTypeFactory .Void ,
314+ parameterTypes : [ module .CorLibTypeFactory .Int32 , module . CorLibTypeFactory . String ]
315+ )
316+ );
315317```
316318
317319See also [ Metadata Signatures] ( metadata-signatures.md ) for more information on type and method signatures.
0 commit comments