Questions tagged [invocation]

187 questions
4
votes
1 answer

Options for invoking methods dynamically in C#

I've seen quite a few questions related to how do I invoke a method like this and that. What I haven't found is a listing of the different options of how to invoke a method via reflection or any other means in csharp. Can someone explain in detail…
Sean Chambers
  • 8,572
  • 7
  • 41
  • 55
4
votes
2 answers

Throwing exception by InvocationHandler

I have a lock manager as a proxy class which implements InvocationHandler, I want this lock manager to throw exceptions (e.g. DeadLockException) to the object which is calling this proxy object, and I want the caller to be able to catch this…
4
votes
3 answers

Java explicit constructor invocation & Instance Initializer

In The Java Tutorials - Initializing Fields, have a description about Instance Initialization Blocks(Instance Initializer): The Java compiler copies initializer blocks into every constructor. Therefore, this approach can be used to share a block…
Wuaner
  • 929
  • 2
  • 14
  • 31
3
votes
2 answers

Cost of nested method invocation in Java

My assumption is that, with compiler optimization (e.g., inlining), it makes practically no difference whether a method is "nested" a few levels. Would that be the case indeed? For example, say that the following 3 classes are declared: public class…
PNS
  • 19,295
  • 32
  • 96
  • 143
3
votes
2 answers

What exactly means Visibility Private?

I write the following into a script module (i.e. a psm1 file) and do Import-Module for that file: New-Variable -Name 'mytest' -Value 'Foo' -Scope 'Global' Now I can access this variable in my PowerShell session. $mytest yields Foo, for…
Hermjard
  • 61
  • 4
3
votes
1 answer

How to use jq for a query where key is a numeric string

Recently discovered jq and am using it to format some data. How do I use it to access fields of a json object that happen to be numeric strings? For example, the following fails for me with an error: echo '{"20":"twenty"}' | jq .["20"] What's the…
David Bau
  • 3,681
  • 2
  • 18
  • 13
3
votes
1 answer

Google Assistant equivalent of Alexa tell [skill] to

With Amazon Alexa it is possible to invoke an intent from a skill in 2 ways: "Alexa start [skill name]." And then proceed to ask that skill for a specific intent. "Alexa tell [skill name] to [specific intent]." With Google Assistant I only know of…
DaReal
  • 597
  • 3
  • 10
  • 24
3
votes
2 answers

Crockford "new" method

hope someone can help me to break down a snippet of code from Crockford's JS Good Parts: Function.method('new', function ( ) { // Create a new object that inherits from the // constructor's prototype. var that = Object.create(this.prototype); …
3
votes
4 answers

Why is null check performed after argument list evaluation?

According to C# Language Specification 7.4.3 Function member invocation the runtime processing of function member invocation consists of the following steps, where M is instance function member declared in a reference-type, E is the instance…
Andrew Karpov
  • 431
  • 2
  • 7
3
votes
1 answer

JNI cached jclass global reference variables being garbage collected?

I'm working in the JNI Invocation API, calling into Java from C. I have some upfront initialization to cache 30+ Java classes into global references. The results of FindClass are passed into NewGlobalRef to acquire a global reference to the class.…
bubbadoughball
  • 193
  • 2
  • 11
3
votes
6 answers

Simple JavaScript function with immediate invocation does not work... why?

Can anybody explain why this works: var sayHello = function (name) { alert("Hello there " + name + "!"); }("Mike"); While this does not: function sayHello (name) { alert("Hello there " + name + "!"); }("Mike"); Mike Peat
Mike Peat
  • 445
  • 1
  • 6
  • 14
3
votes
1 answer

Calling delegates in a boxing-like fashion

I have often seen code examples of delegate invocation being done as follows: ` public delegate void DelegateThreadActivity (T sender, U e); public event DelegateThreadActivity OnStart = null; public…
Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
2
votes
2 answers

XamlParseException stopping project

I am learning C# 2010 using the book 'Microsoft VS C# 2010 Step by Step' whose Chapter 27 introduces the Task Parallel Library. When I run the provided 'GraphDemo' project, I get an XamlParseException error. I went over several of the threads on…
2
votes
1 answer

Error creating args array of jvalues for NewObjectA() function - JNI Invocation API

I'm trying to create a jobject in C++ by calling the NewObjectA() function using the JNI invocation API. However, I am unsure how I should pass arguments into the constructor. The JNI API documentation states: jobject NewObjectA(JNIEnv *env, jclass…
Ddor
  • 347
  • 1
  • 12
2
votes
4 answers

How to do dynamic object creation and method invocation in .NET 3.5

How does the code looks that would create an object of class: string myClass = "MyClass"; Of the above type, and then call string myMethod = "MyMethod"; On that object?
thr
  • 19,160
  • 23
  • 93
  • 130
1 2
3
12 13