The System.Reflection.Emit namespace contains classes that allow a compiler or tool to emit metadata and Microsoft intermediate language (MSIL) and optionally generate a PE file on disk.
Questions tagged [reflection.emit]
737 questions
0
votes
1 answer
Emitting IL in Windows Phone 8
I'm trying to create classes dynamically to import XAML binding. It's working well in WPF, but not in Windows Phone 8. Apparently, Windows Phone 8 does not support binding to a dynamic data context (it just doesn't try to invoke any of the dynamic…

zmbq
- 38,013
- 14
- 101
- 171
0
votes
1 answer
Can I emit existing implementations in "temporary" assembly
Take the following C# code
namespace lib.foo {
public class A {
public A (int x) {}
public int GetNumber() { return calculateNumber(); }
private int calculateNumber() { return lib.bar.B.ProduceNumber(); }
public void…

derabbink
- 2,419
- 1
- 22
- 47
0
votes
0 answers
Emit Reflection (vb.net) Dynamically Reflect dropbox results in property grid
trying to add a dropdown into a property grid
Im using VS2010 VB.net with reflection
For my full solution - Download it here
https://www.nyvault.com/files/reflection/xml_propgrid_reflect_sk.zip
Password is
1
The point of this project is to…

Ess Kay
- 598
- 4
- 20
0
votes
1 answer
Serialize run-time created type
I have created a type with System.Reflection.Emit following MSDN doc
I create my type and an instance with this code :
//following the tutorial I created a method which returns a dynamic type
Type myDynamicType = CreateNewObject("MyDynamicType",…

nemantro
- 135
- 1
- 5
0
votes
3 answers
Why can I inherit from a generic type at runtime, but not compile time?
So I was doing some experimenting, and I found that while this:
public class SelfOfT
{
// This won't compile
public class FailureOf : T
{
}
}
fails, this, on the other hand:
public class SelfOfT
{
public interface…

sircodesalot
- 11,231
- 8
- 50
- 83
0
votes
1 answer
is there any way to search through cs file
I have a requirement to list out the methods in the cs files and list the each method call inside a method .
For example : i have a class
public void method1 ()
{
c2.M2();
}
public void method2 ()
{
c2.m3();
}
Here c2 is another class and…

ansar
- 128
- 13
0
votes
1 answer
No DLL access when created by IL Generator
I created a dummy DLL. I was expecting I can access S1 in the namespace. I can see my function and I can see the struct with il dasm when its in exe form.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using…
user34537
0
votes
1 answer
System.CodeDom.CodeCompileUnit from System.Reflection.Emit.AssemblyBuilder instance
I'm looking at CodePlex code for TLBImp2 and want to generate C# source code from the IL emitted.
Is there a way to get a System.CodeDom.CodeCompileUnit from a System.Reflection.Emit.AssemblyBuilder instance?
Roger
0
votes
1 answer
Calling a method on a field
I'm just curious on how I would call a method on a field using Emit.
I have this class generated
public class AClass : IDynamicProxyTestInterface
{
private DynamicProxy proxy;
public…

Kelly Elton
- 4,373
- 10
- 53
- 97
0
votes
1 answer
Generate function which return property value of property
I am trying to emit following:
This is struct which will be included as property to a dynamically emited class:
public struct GeoPoint
{
public double? lat { get; set; }
public double? lon { get; set; }
}
I have to emit following…

Vitaliy Kalinin
- 1,791
- 12
- 20
0
votes
1 answer
PEVerify Warning Parameter out of Sequence
I've built an assembly using Reflection.Emit. Running PEVerify returns 214 warnings of the same type:
[MD]: Warning: Parameter out of sequence (parameter: 1; seq.num: 1). [token:0x06000171]
Unfortunately there isn't much documentation around these…

Thomas Coats
- 632
- 5
- 10
0
votes
1 answer
How, with reflection, can I set an assembly to be 32-bit (i.e. x86)
I know I can use CORFLAGS to force a .NET assembly to 32-bits. How can I do it when I am using reflection to create the assembly in the first place? There seems to be a function to get the value (…

Rob
- 3,315
- 1
- 24
- 35
0
votes
1 answer
Generate dynamic code from string with Reflection.Emit
I have stored some C# code in a database table.
I have the whole code of a base class in a string.
With the stored C# code in hand, I add to the class a method named m1 that contains a return <>; (the method always returns object so…

Julio Kriger
- 49
- 4
0
votes
1 answer
Use C# EnumBuilder to create Enum with Attribute
I have used the EnumBuilder in C# to create Enums based on tables in my database. However, as my framework is designed, the enums we have also contain an attribute which is usually the name associated with the ID in the database.
What I am trying…

mr fish
- 17
- 4
0
votes
1 answer
Using FastActivator in place of Activator.CreateInstance()
Trying to use Class shown here as a sample for Activator.CreateInstance()
http://codeblocks.codeplex.com/wikipage?title=FasterActivator%20Sample
public static List SortedCollection(SPListItemCollection items, ListSortType sortType,…

Wesley
- 5,381
- 9
- 42
- 65