reflection

InvokeMember is very slow, anyway to avoid this?

I have to do reflection and late binding so i don't know if there is a way to speed things up. Thought I would give it a shot. This snippet takes about 15 seconds to complete which is way too slow, but seeing how I need to read the metadata. private static object InvokeCall(Type HostObjectType, Object HostObject, CallType callType, st...

ReportViewer: How to load report as an embeddedresource in another assembly using reflection?

I'm not really sure how to go about this. I created a generic class to open reports up for my application. The reports are contained in another DLL that is not referenced as an embedded resource though. If I reference the DLL I can just do: Viewer.LocalReport.ReportEmbeddedResource = "SomeLibrary.ReportName.rdlc"; However, since I'm no...

What when assembly.GetReferencedAssemblies returns ".exe" dependency ?

Hi all, there is a lot of examples how to load all dependencies from some assembly like: var assembly = Assembly.ReflectionOnlyLoadFrom(assemblyPath); foreach (var assemblyName in assembly.GetReferencedAssemblies()) { try { Assembly.ReflectionOnlyLoad(assemblyName.FullName); } catch { Assembly.ReflectionOnlyLoadFrom(Path.Co...

PropertyInfo.GetValue() how do I index collection by string using reflection in C#?

Hi Guys. Let's say I have a class, which has a NameValueCollection property. public class TestClass { public NameValueCollection Values { get; private set; } public TestClass() { Values = new NameValueCOllection(); Values.Add("key", "value"); Values.Add("key1", "value1"); } } I know how to get...

Is it possible to change the value of a string property within a .NET AppDomain from another seperate .NET AppDomian.

Hi, Is it possible to change the value of a public property (type string) of a class within a given .NET AppDomain from another separate .NET AppDomain assuming both AppDomain's are running in the same process. The other important assumption is that the code running in the AppDomain that contains the property can not be modified .. ie ...

How to calling a function in a .net dll through an interface loaded through reflection.

Hello I'll try my best to explain this. Basically, I am loading a library through reflection using the Assembly.LoadFile. From there I have an interface IFace that defines a method "GetStrings" that returns an array of strings. The dynamically loaded DLL has a class named "Class1" that implements IFace. I need a way to call this inte...

used reflection in c# works, but two errors need help solving, function called just cannot do anything!

this http://stackoverflow.com/questions/3975659/calling-the-function-which-is-stored-in-a-string-variable wrote the following, but there are two errors which i can not solve, do not understand why they are coming (the error is mentioned with the statement causing it as //error is) please help using System; using System.Collections.Ge...

Any tools to export .NET assembly member's metadata to Excel Sheet

Is there a tool that can reflect a .Net Assembly and gets its metadata, viz, Types, Type Members, Access Modifiers details, (Comments?) into an Excel Sheet(s)? ...

Read object properties by reflection

In .NET I have and instance of class A which includes instances of classes B,C,D and some primitives(int, double, string,bool...). I need to read(and then write to text field) all properties(recursively) of instance, if property is another instance, then read its properties etc. But I don`t want to go into .NET types(strings,...). I try ...

Create an instance of a web control using reflection

How can I create an instance of a web control at runtime using reflection? I created a series of controls that implement a common interface and I would like to create these controls based on the name of the control which is stored in my database. I have attempted (and failed) to create an instance of these controls using Activator.Crea...

NullReferenceException from AlphaImage.CreateFromResource()

I am using the AlphaMobileControls library for the .NET Compact Framework. I am using AlphaImage.CreateFromResource(imageResourceName) to create an AlphaImage object. The problem is that this method is throwing a NullReferenceException. Looking at the code for this method, the problem is that this line of code is returning null: MemoryS...

Given a property name, how can I create a delegate to get its value

We have some code that given a property name uses reflection to implement a Comparer. I would like to store a delegate/Func to get the value rather than paying the reflection price each time we need to get a value. Given a class like this: public class Person { public string Name { get; set; } public int Age { get; set; } } ...

Be careful with version numbers for loading signed assemblies

I've spent an hour debugging this, and I finally eliminated the PEBCAK issue. I have an internationalized application. A key part of the application uses reflection to load types from configured sources. So in configuration, there's an entry like this: <component type="Application.Component" assembly="Application, Version=2.0.0.0, Cult...

What is the best way to get only certain properties using reflection?

I am trying to come up with the best way to get only certain properties from a type using reflection. How can I differentiate the properties from each other? Let me add this to help clarify my question. I understand that I can use binding flags or name. But say I want only a certain four properties. Would the best way be to create a...

java reflection question

Hi, I'm trying to solve the following issue in reflection. I've a POJO which kind of acts as a metadata for the method signature in TestResponse class. TestResponse has a setDate() methid which takes a Date parameter. I'm trying to make this is a generic code which can accept any method and its signature to set in the response. What I'...

Is the order of FieldInfo[] Type.GetFields() Guaranteed?

Currently I do something like this: class Foo { // Declare Fields [FieldName("F_BAR")] public int? Bar; [FieldName("F_BAZ")] public int? Baz; [FieldName("BLARG")] public double? Bee; // And a custom selector public static string FooFields() { // which looks something like: StringBuilder fie...

Reflection in Objective-C (iPhone)

I want to populate [MyClass class] from a JSON string. I use json-framework to get the NSDictionary, and it's dead easy to instantiate and setValue: forKey:... on my data object. But for more complex data objects with classes as members of MyClass, ie: MyOtherClass *classNoTwo I tried with Class test = object_getClass(myClass.cl...

Java+Reflection: Invoke method on variable access. Is it possible?

Hi All, I was wondering if it is possible, using reflection, or something similar to invoke a method whenever a variable is accessed in read or write mode. In a nutshell my goal is similar to the behavior of C# properties. Example: Let's say I have a two classes A and B... public class A{ public int field; public void foo(){ ...

Can't get argspec for Python callables?

I'm playing with Python callable. Basically you can define a python class and implement __call__ method to make the instance of this class callable. e.g., class AwesomeFunction(object): def __call__(self, a, b): return a+b Module inspect has a function getargspec, which gives you the argument specification of a function. H...

Setting up QtJambi connections from JRuby

I've been setting up a Qt gui using QtJambi and JRuby. So far things have gone well. I'm ready to start setting up connections, however, many of the signals don't seem to be visible from jruby. For example, if I print out the methods of QPushButton, I don't see any method called "clicked" for me to build a connection from. I found ...