Reflection is the process by which a program can observe and modify its own structure and behavior at runtime.
1
vote
0answers
9 views
creating object using reflection in windows appplication
I want to send a function 2 parameters.
1. Type of class
2.Name of object.
In the new function I want to create the object by the type and the name that was given.
for example:
private void ...
62
votes
4answers
42k views
0
votes
2answers
45 views
How does the Java Class class getMethod function work?
I'm studying this code about Java Inheritance(from Core 2 java bk by Hoffman), and here's a code in the class MethodPointerTest.java :
Method square = MethodPointerTest.class.getMethod("square", ...
0
votes
0answers
30 views
After ILMerge Assembly.GetAssembly and similar throw ReflectionTypeLoadException
i use ILMerge via code, using the following snippet to get my merged .exe (Windows Console Application)
var ilMerge = new ILMerge();
ilMerge.SetInputAssemblies(files);
ilMerge.OutputFile = ...
0
votes
5answers
241 views
How to identify setter method using property name?
Can we find setter method name using property name?
I have a dynamically generated map<propertyName,propertyValue>
By using the key from map (which is propertyName) I need to invoke the ...
6
votes
3answers
198 views
Java method takes seemingly lot of time that I cannot account for
Using JProfiler, I've identified a hot spot in my Java code that I cannot make sense of. JProfiler explains that this method takes 150μs (674μs without warmup) on average, not including the time ...
-1
votes
0answers
29 views
Modifying a class in OSGi on runtime and reload
I developed an activemq application and mapped the single components into different osgi bundles. So there is a broker-bundle, a custom-made service bundle for the broker, producer-bundle, ...
0
votes
2answers
66 views
Create a class dynamicaly in c#
Can I create a dynamic class at runetime, withot knowing the fields name of the class beforehand?
For example, if I let the user entre a list of strings, and when he sends the list, I create a class ...
0
votes
0answers
12 views
Adding ServiceContract/OperationContract at runtime
I am trying to write an small piece of code that makes existing interfaces (and their implementations) usable with WCF.
I am looking forward to a way in which I can add the ServiceContractAttribute ...
1
vote
0answers
11 views
Using Cecil, how can I verify if a method is called inside another method
I tried to find an example of this but without success so that's is why I asked this question.
Lets start with some code. Here's my code:
class Dummy
{
public void DoDummyThings1()
{
...
6
votes
6answers
5k views
How create High Performance .NET classes using reflection?
Ok, so we all know Reflecttion is many time less performant than "newing" a class instance, and in many cases this is just fine depending on the application requirements.
QUESTION: How can we create ...
1
vote
2answers
14 views
Scalably add classes for instantiation in a jar
I need some advice on a paradigm to follow. Before, I had something like this
package/Instantiator.class
package/instances/GenericInstance.class (abstract)
package/instances/AInstance.class ...
0
votes
2answers
77 views
Cast List<object> to unknown T[] using reflection
I found something similar on another question but i couldnt solve my problem as i'm still quite new in c#.
i have
System.Type type; // for example int[]
System.Type elementType = ...
1
vote
1answer
27 views
Use Scala's reflection API for dynamic factory class instantiation
I am new to the Scala reflection capabilities. I was wondering if it possible to build a factory object that delivers instantiations of different classes according to a type-parameter.
The code below ...
0
votes
0answers
13 views
Accessing a list of defined preprocessor directives using reflection
I'm trying to implement a decent system for enable conditional compiling of logging methods. I'd like to enable/disable calls to log functions on a per-class or per-group selection.
I know there how ...