Questions tagged [dynamic-invoke]

22 questions
184
votes
2 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
  • 49,653
  • 18
  • 119
  • 157
139
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
  • 6,587
  • 13
  • 49
  • 72
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
  • 1,939
  • 2
  • 25
  • 34
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
  • 266,361
  • 143
  • 616
  • 705
5
votes
3 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,651
  • 1
  • 30
  • 52
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,037
  • 1
  • 10
  • 19
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…
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
  • 60,384
  • 28
  • 166
  • 207
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,209
  • 1
  • 19
  • 39
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,021
  • 8
  • 22
1
vote
1 answer

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
  • 3,956
  • 5
  • 23
  • 52
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,861
  • 17
  • 42
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
  • 25,736
  • 34
  • 119
  • 148
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() …
1
vote
2 answers

How do I pass an object array into a method as individual parameters?

I have the following code: public class MyClass { private Delegate m_action; public object[] m_args; public MyClass() { } public MyClass(Delegate action, params object[] args) { m_args = args; m_action…
MintGrowth
  • 4,831
  • 9
  • 58
  • 88
1
2