reflection.emit Questions
1
Solved
This is my first foray into using Reflection.Emit. I'm dynamically building a proxy for a provided object. The proxy passes any public property accesses through to the provided object. The error I'...
Aeromechanic asked 21/12, 2012 at 13:18
3
I've got some code that generates various Func<> delegates using System.Linq.Expressions and Expression.Lambda<Func<>>.Compile() etc. I would like to be able to serialize the gene...
Kraemer asked 26/2, 2010 at 22:18
1
Solved
I have the following C# code:
public static double f2(Func<double, double> f, double x)
{
return f(x);
}
And here it's IL code:
.method public hidebysig static
float64 f2 (
class [ms...
Ideational asked 9/10, 2012 at 21:26
1
Solved
Toying with making a compiler for my own language, I'm trying to generate some MSIL code using the Reflection.Emit framework. It works fine when using int when I declare local variables. However, w...
Physic asked 14/9, 2012 at 22:54
2
Solved
I wish to generate (emit) class that implement an Interface at run-time with C#.
I have succeeded to emit methods and properties, but I failed to emit an event.
Here is the code I wish to emit:
...
Robledo asked 2/9, 2012 at 8:4
3
Solved
Facts:
The correct encoding for the CIL instruction rethrow's op-code is the two-byte sequence FE 1A.
OpCodes.Rethrow.Value (which has type short) has value 0xFE1A on my little-endian machine.
Bi...
Balling asked 18/8, 2012 at 0:7
2
Solved
I would imagine this might use Reflection.Emit,
but a similar question on SO only answers how to create a class/method dynamically, not how to update an existing class.
In a similar vein, is it p...
Lanneret asked 22/6, 2012 at 18:28
1
Solved
I'm trying to make if-else working in IL by System.Reflection and System.Reflection.Emit. This is the code which I currently have:
Label inequality = new System.Reflection.Emit.Label();
Label equa...
Balsa asked 21/6, 2012 at 14:2
3
Solved
I'm currently facing new problem with operators. Using following code, I want to make output that would be same as when using if ... else pair in C#.
var method = new DynamicMethod("dummy", null, ...
Qktp asked 21/6, 2012 at 13:26
2
Solved
I'm generating wrappers for types by using System.Reflection.Emit. At one point it's possible that the original object is throwing a error on access ( FaultException ) and the error should be catch...
Blase asked 21/2, 2012 at 9:41
1
We are going to build a web service from metadata read at runtime. I mean the entire web service: the signatures, contracts and implementation.
There are two main paths I see from here.
The first...
Grenadier asked 14/1, 2012 at 18:18
2
Solved
I need to create a class dynamically. Most things work fine but i'm stuck in generating the constructor.
AssemblyBuilder _assemblyBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly(new Assem...
Pinnati asked 10/4, 2012 at 14:7
1
Solved
I have the following classes:
public class Entity<T> where T : Entity<T> {
public Factory<T> Factory { get; private set; }
public Entity(Factory<T> factory) {
Factory = ...
Schear asked 9/4, 2012 at 17:16
1
Solved
I have new problem. My code:
.method public static void Main() cil managed
{
.entrypoint
// Code size 3 (0x3)
.maxstack 1
IL_0000: ldnull
IL_0001: stloc.0
IL_0002: ret
} // end of method Pro...
Deputize asked 3/4, 2012 at 16:49
4
Before all, I know about AutoMapper, and I don't want to use it. Because I'm learning C# and I want to receive a deep view of it. So I'm trying to do this issue (explained below) myself.
However, ...
Shiller asked 18/3, 2012 at 20:51
1
Solved
Is it possible to use generics with the IL Generator?
DynamicMethod method = new DynamicMethod(
"GetStuff", typeof(int), new Type[] { typeof(object) });
ILGenerator il = method.GetILGenerator(...
Checkerbloom asked 21/3, 2012 at 19:22
1
I've come across dynamic methods a little in reflection-based C# code, and I'm yet to figure out precisely what they are. There specifically seems to be a DynamicMethod class that allows the genera...
Ninos asked 18/3, 2012 at 4:27
1
Solved
First, some background info:
I am making a compiler for a school project. It is already working, and I'm expending a lot of effort to bug fix and/or optimize it. I've recently run into a problem w...
Swink asked 9/3, 2012 at 23:49
2
Solved
Can I build a class as shown below dynamically using reflection? There are no methods, just public variables, some have custom attributes.
Is the .Emit method required (from what I've seen, "Emit...
Scup asked 23/2, 2012 at 13:28
2
I was playing around with Reflection.Emit and found about about the little-used EmitCalli. Intrigued, I wondered if it's any different from a regular method call, so I whipped up the code below:
us...
Hematite asked 5/5, 2011 at 5:22
1
Solved
I'm trying to implement this pattern using Reflection.Emit (TypeBuilder):
public class ClassToBeProxied
{
public virtual object Property1 { get; set; }
}
public class Proxy : ClassToBeProxied
{
...
Zerlina asked 3/1, 2012 at 23:45
6
Solved
Background:
I want to define few static methods in C# , and generate IL code as byte array, from one of these methods, selected at runtime (on client), and send the byte array over network to anot...
Metempsychosis asked 6/10, 2011 at 7:14
5
I need to generate a class using Reflection.Emit that implements the following interface.
public interface IObject
{
T Get<T>(string propertyName);
}
Does anyone have an example of how I...
Kowalski asked 30/10, 2009 at 18:13
4
Solved
I found this but tried to use it and failed.
How can i create an object using reflections and make it fast by putting it in a delegate?
DynamicMethod dm = new DynamicMethod("MyCtor", t, new Typ...
Wiedmann asked 12/1, 2010 at 18:27
1
Solved
I am developing a software that will serve as back-end for a data-ware house, in which fact definitions will be read from an xml file and corresponding fact/dimension tables will be created on the ...
Penland asked 27/7, 2011 at 18:49
© 2022 - 2024 — McMap. All rights reserved.