File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
snippets/visualbasic/System.Reflection.Emit/TypeBuilder/DefineMethodOverride Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <OutputType >Exe</OutputType >
5+ <TargetFramework >net9.0</TargetFramework >
6+ </PropertyGroup >
7+
8+ </Project >
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ Class Test
3939 Dim name As String = "DefineMethodOverrideExample"
4040 Dim asmName As New AssemblyName(name)
4141 Dim ab As AssemblyBuilder = _
42- AppDomain.CurrentDomain .DefineDynamicAssembly( _
43- asmName, AssemblyBuilderAccess.RunAndSave )
42+ AssemblyBuilder .DefineDynamicAssembly( _
43+ asmName, AssemblyBuilderAccess.Run )
4444 Dim mb As ModuleBuilder = _
45- ab.DefineDynamicModule(name, name & ".dll" )
45+ ab.DefineDynamicModule(name)
4646
4747 Dim tb As TypeBuilder = _
4848 mb.DefineType( "C" , TypeAttributes.Public, GetType (A))
@@ -84,9 +84,6 @@ Class Test
8484
8585 Dim tc As Type = tb.CreateType()
8686
87- ' Save the emitted assembly, to examine with Ildasm.exe.
88- ab.Save(name & ".dll" )
89-
9087 Dim test As Object = Activator.CreateInstance(tc)
9188
9289 Dim mi As MethodInfo = GetType (I).GetMethod( "M" )
You can’t perform that action at this time.
0 commit comments