Questions tagged [dynamic-invoke]
23 questions
198
votes
3 answers
What is the __DynamicallyInvokable attribute for?
Looking through System.Linq.Enumerable in DotPeek I notice that some methods are flavoured with a [__DynamicallyInvokable] attribute.
What role does this attribute play? Is it something added by DotPeek or does it play another role, perhaps…

Jamie Dixon
- 53,019
- 19
- 125
- 162
159
votes
1 answer
Difference Between Invoke and DynamicInvoke
What is the difference between Invoke and DynamicInvoke in delegates? Please give me some code example which explain difference between that two methods.

testCoder
- 7,155
- 13
- 56
- 75
12
votes
3 answers
Is there a way to do dynamic implicit type casting in C#?
Given this class with an implicit cast operator:
public class MyDateTime
{
public static implicit operator MyDateTime(System.Int64 encoded)
{
return new MyDateTime(encoded);
}
public MyDateTime(System.Int64 encoded)
{
…

Eric
- 2,029
- 2
- 26
- 36
11
votes
3 answers
Can Delegate.DynamicInvoke be avoided in this generic code?
This question is partly about delegates, and partly about generics.
Given the simplified code:
internal sealed class TypeDispatchProcessor
{
private readonly Dictionary _actionByType
= new Dictionary();
…

Drew Noakes
- 300,895
- 165
- 679
- 742
6
votes
2 answers
alternative for using slow DynamicInvoke on muticast delegate
I have the following piece of code in a base-class:
public static void InvokeExternal(Delegate d, object param, object sender)
{
if (d != null)
{
//Check each invocation target
foreach (Delegate dDelgate in…

Emiswelt
- 3,909
- 1
- 38
- 56
4
votes
1 answer
Build expression tree for method decoration?
I’m building a class named CommandHandler that have ExecuteCommand method that have Command as input parameter.
The Idea is that ExcecuteCommand will check command name and execute proper class method by the name pattern so when command name is Test…

dnf
- 1,659
- 2
- 16
- 29
3
votes
1 answer
Callback functions: passing callbacks from a C# winform app to a referenced VC++ Exe
Asynchronous Callback Functions
Perspective: I am upgrading several VB6 ActiveX applications to C#.net, which all talk to each other using callback functions which they register with a referenced VC++.net executable.
I cannot replicate the following…

rap van winkle
- 41
- 3
3
votes
1 answer
Having problem dynamically invoking unmanaged VB COM dll from c#?
I have a problem calling unmanaged VB COM dll from c#. This is dynamic invocation using loadLibrary and GetProcAddress.
I can successfully loaded the dll using loadLibrary , but the GetProcAddress always return 0. It wasnt log any error msg and…

RameshVel
- 64,778
- 30
- 169
- 213
2
votes
1 answer
Method 'System.Object DynamicInvoke(System.Object[])' has no supported translation to SQL
Let's say that I have a table named Poll and I want to write a LINQ Extension to list all polls that have ID belong to an array. For e.g:
void Main()
{
long[] ids = new long[]{ 1,2,3,4,5,6,7,8,9 };
ListFail(Poll, p => p.ID, ids);…

ByulTaeng
- 1,269
- 1
- 21
- 40
1
vote
2 answers
Puzzle involving unwound stacks on dynamic invoke
This is a new attempt to pose a version of a question asked less successfully this morning.
Consider the following program, which we'll run once inside Visual Studio 2010 and once more by double-clicking the executable directly
namespace…

Ken Birman
- 1,088
- 8
- 25
1
vote
2 answers
Fast way to get Expression method call target
Given the following code line of code,
Expression expression = () => target.ToString();
is there a fast way to obtain the target object?
Below code works
public object GetExpressionTarget(Expression expression)
{
…

Thomas Flinkow
- 4,845
- 5
- 29
- 65
1
vote
1 answer
Truly no way to "generate" C# from byte[] containing IL with method body?
I`ve being playing around with reversing of some obfuscated code out there and I have stumbled upon one tricky DLL that had a "method body" (IL code) in a byte[] array and was later on invoking it with dynamic invoke. Is analyzing MSIL the only way…

MZ64
- 21
- 2
1
vote
1 answer
How to construct a MethodType for a method with variant parameters
I failed to create a MethodType for a method lookup in Java. Below is my code. In this code, I want to create a MethodType for the sample::gwd method, and then retrieval reference to this function by lookup().findStatic. It is clearly that i can not…

shijie xu
- 1,975
- 21
- 52
1
vote
1 answer
Generating a Call Hierarchy for dynamicly invoked method
Today's world of dynamic invoke, reflection and runtime injection just doesn't play well with traditional tools such as ctags, doxygen and CDOC.
I am searching for a method call hierarchy visualization tool that can display both static and dynamic…

Maxim Veksler
- 29,272
- 38
- 131
- 151
1
vote
0 answers
Add Multicast Delegate and Call with DynamicInvoke()
I have the current code that will print mathematical results of input numbers using delegates.
Imports System.Delegate
Module Module1
Dim a As Decimal
Dim b As Decimal
Dim Answer As Integer
Private Delegate Sub myDelegate()
Sub Main()
…

user3083405
- 11
- 3