All Questions
Tagged with dynamic-method or dynamicmethod
163 questions
1 vote
1 answer
79 views
How do I get the parameter types of a custom C# dynamic method if args are passed as null?
I have been working with creating a custom C# DynamicObject class. I have overloaded TryInvokeMember() and have it working except for some methods that use out parameters. I need to be able to get ...
0 votes
1 answer
614 views
How to access a function in child project's build.gradle.kts which is defined in root project's build.gradle.kts
I have a gradle based project using Kotli DSL. The hierarchy is like the following. root-project --> child-project A function is defined in root project's build.gradle.kts file. fun printHello() { ...
0 votes
1 answer
272 views
Create a Field using FieldBuilder and add one to Field Value in MethodBuilder ILCode Emit
I have a Method that creates a MethodBuilder Method and defines the Behaviour using ILGenerator and Emit + OpCodes. This Method was created with the help of a previous StackOverflow Question I made - ...
0 votes
0 answers
38 views
How to add class method dynamically through constructor (PHP). N.B: I do not need method in object (ex: $this->$methodName). not like that
/** * @return string */ public function getCityIdEncryptedAttribute(): string { return encrypt($this->city_id); } I want to generate this method dynamically in the ...
1 vote
1 answer
211 views
How return vectors' scalar product using Expression trees
I try to return vectors' scalar product using expression trees, but I can not loop into arrays, can u help me? The task description and code please see below: public class CodeGeneration { public ...
1 vote
0 answers
43 views
Why the DynamicMethod cant work in ExcelDna
I want to create user-defined formula in Excel addin by ExcelDna ,and before I get the api response I don't know the name of the formula.All of the formula is just like that(It's worked good): public ...
0 votes
1 answer
169 views
Get field value by using DynamicMethod
I'm trying to get the field value by using DynamicMethod instead of Reflection. If I change the field fldTest to static, the code works fine but I need also non-static field. When I run the code as ...
0 votes
0 answers
49 views
Creating Dymamic Method throws en exception
I want to create some dynamic method whcih has 2 cycles: in first some N values are pushed onto evaluation stack, in second - these N values are popped from stack. But CreateMethod throws ...
0 votes
1 answer
371 views
Call a System.Action in a .NET dynamic method
I have a function that is building a dynamic method. As part of this dynamic method, it is calling an action known at generation time. As a minimal reproducible example, consider the following C# code:...
2 votes
1 answer
462 views
DynamicMethod Reflection Emit a call to a Func<Task>
I am figuring out Reflection.Emit for some internal libraries and got stuck with calling a Func passed in as an argument. My scenario test uses the code transferred to IL with Linqpad in the picture ...
5 votes
1 answer
633 views
How do I turn an Action<T> to a Compiled Expression or a DynamicMethod by generating IL in C#?
I am having to deal with maintaining a library which allows users to register a generic handler (Action<T>) against it and later on once it receives an event it goes through each of the ...
0 votes
0 answers
593 views
How to do OpCodes.Call properly?
I'm practicing DynamicMethod from this post, and it all worked fine with the following little codes: private delegate long squareDel(int a); squareDel test; private void Form1_Load(object ...
0 votes
0 answers
67 views
Python - how to make dynamic method
I wonder how i can assign dynamic method (for example ".text" or ".split()") to my variable. some_selector = "div.test" # is it possible to add here a method? For ...
0 votes
0 answers
347 views
C# - Reflection.Emit: Return reference to a local variable
I want to make a DynamicMethod which in turn behave like the following for example: AnyClass myClass = new AnyClass(); Func<AnyClass> myFunc = () => myClass; I know that when I want to make ...
0 votes
0 answers
22 views
Calling class methods dinamically using Python [duplicate]
A functional example (out of class) for a better explanation about what I'm trying to get. def greet(): print('Hello world') func = 'greet' func() But, if I use same example as a class method, I ...