Skip to main content

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
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 ...
Kumin's user avatar
  • 83
-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 ...
ivoronline's user avatar
  • 1,019
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 ...
Martin's user avatar
  • 67
-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 "...
Munawar's user avatar
  • 2,586
-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. ...
user1673665's user avatar
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 ...
user24538254's user avatar
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, ...
Masa Maeda's user avatar
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(&...
user14381362's user avatar
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 ...
devopsdinosaur's user avatar
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: ...
tahasozgen's user avatar
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; #...
tesmo's user avatar
  • 155
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. ...
Fakima's user avatar
  • 11
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[...
Derek's user avatar
  • 919
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") ...
Bushra Saifi's user avatar
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 ...
Dan's user avatar
  • 12.5k

15 30 50 per page
1
2 3 4 5
1674