Questions tagged [reflection]
Reflection is the ability of a program to observe and/or modify its structure and/or behavior at runtime. Reflection is dependent on the supporting programming language - please tag the programming language being used when using this tag.
reflection
25,097
questions
0
votes
0
answers
95
views
+50
Modelmapper - Automatic mapping (STRICT Strategy)
[INFO] I've created a sandbox repository to simplify your experience, so you can clone and test it fast.
https://github.com/ImKumin/AutomaticMapping
How can I automatically map models like the ones ...
-2
votes
1
answer
46
views
Hot to cast using Class returnType obtained through reflection?
I am using reflection to get return type of method which is String.
When I invoke function I need to cast return value to String.
How can I do that without explicitly using String and instead to use ...
0
votes
0
answers
27
views
Replacing a method call via reflection in C# does not work in a Unity environment
In Unity6 (6000.0.7f1), I've tried to redirect a method call to my own method using the MethodRedirect extension method from this GitHub repo.
From the Scenario1 example code in the GitHub repo, I ...
-1
votes
0
answers
19
views
How to load merged dlls with assembly.load
multiple dlls (a.dll, b.dll, c.dll) are merged into single assembly/dll "MergedAssembly.dll"
Assembly.LoadFrom("d:\runtime\MergedAssembly.dll");
but it fails with message "...
-3
votes
1
answer
55
views
Foreach can't be used for variables of type "PropertyInfo" because "PropertyInfo" has no defintion for "GetEnumerator"
I want to iterate throug a Dictionary<string, object> with a foreach loop. First I get all of the items with reflection. And when item.Name is not settings the program goes in the else path. ...
0
votes
1
answer
35
views
Testing Multiple Classes with Dependecies with Reflections
we're recently building a java-compiler for college and need to test our compiled files with java reflections. I've had no problem with this tool until now. We need to test if multiple files with ...
0
votes
3
answers
78
views
Can a Go interface receive any function, regardless of its signature?
EDIT: A couple of the answers have suggested changing the signature of the RegisterHandler function, however as part of the original question I asked if it were possible to further restict the types, ...
1
vote
2
answers
54
views
How to determine if a class is generic via reflection in Kotlin
Suppose we have the following class:
data class KeyValuePair<T : Any>(
val key: String,
val value: T
)
If we reflect against the following instance of this class: KeyValuePair(&...
0
votes
2
answers
53
views
Using reflection to set an entry value in generic dictionary
I am attempting to use System.Reflection to modify values in a generic dictionary in which I do not know the types of the IKey and IValue. I am able to set the values of the Dictionary.Entry.value ...
0
votes
0
answers
25
views
Checking the CallingConvention property of MethodInfo
I am working on an ASP.NET MVC project and I am working on reflection.
I tried to determine whether a class does not have a standard, non-static public getter. I have devised the code below:
...
0
votes
1
answer
32
views
Get value of private variable in extension method ES6 class in JavaScript
I have a JavaScript ES6 class in a library that uses some private base values to compute another value.
Abstracted and simplified the situation is something like this:
class Example {
#apples;
#...
0
votes
1
answer
70
views
Exception when trying to make a dynamic database call
I have a group class that contains members, which can be of different class types.
All other functionality regarding this works, I am only missing the database call, which I have run out of ideas on.
...
0
votes
1
answer
61
views
Finding type of List on Scala case class declared field via reflection
I have a Scala case class with a List declared as:
AuxiliaryImages: List[MimeInfo],
I get the field type using reflection:
private def ft(fieldName: String): Class[_] = {
val field = classOf[...
0
votes
1
answer
29
views
Facing issue while registering service of generic class after reading all class of same type using Reflection Assembly in c# dotnet
I have one generic class defined as below. While registering bean/service getting error that it didn't get register properly.
reflection code:
var types = Assembly.Load("Come.Demo")
...
1
vote
1
answer
46
views
How can I check if a class implements an interface in Kotlin?
I have a class c stored in a variable foo. I know that if I had an object of class c I could check if it implemented an interface like this:
cInstance is someInterface
but since the type of foo is ...