reflection

Stuck trying to get Log4Net to work with Dependency Injection.

Hi folks, I've got a simple winform test app i'm using to try some Log4Net Dependency Injection stuff. I've made a simple interface in my Services project :- public interface ILogging { void Debug(string message); // snip the other's. } Then my concrete type will be using Log4Net... public class Log4NetLogging : ILogging {...

Generic method to get a control name when moused over?

Hello, I am writing an application that I am working on a skinning feature to it. What I want to do is allow a user to create an XML document that my code will parse through and set properties of the controls on a form. This is the easy part. Where I am stuck is giving the user a way to find out the control names/types with minimal ...

Finding all Namespaces in an assembly using Reflection (DotNET)

Hi, I've got an assembly (loaded as ReflectionOnly) and I want to find all the namespaces in this assembly so I can convert them into "using" ("Imports" in VB) statements for an auto-generated source code file template. Ideally I'd like to restrict myself to top-level namespaces only, so instead of: using System; using System.Collecti...

Under what situations will Java's field.setAccessible(true) fail?

I have a situation where a user's code is throwing an IllegalAccessException on a field accessed by reflection. Just before accessing the field, setAccessible(true) is called. So, it would seem to me that this method is silently failing. Under what situations would this happen? Could this have something to do with a security manager...

Ref parameters and reflection

I'm not sure if I'm totally missing something here but I can't find any way to determine if a parameter is passed by reference or not by using reflection. ArgumentInfo has a property "IsOut", but no "IsRef". How would I go about to get all reference parameters in a given MethodInfo? ...

Concurrency issues while accessing data via reflection in C#

I'm currently writing a library that can be used to show the internal state of some running code (mainly fields and properties both public and private). Objects are accessed in a different thread to put their info into a window for the user to see. The problem is, there are times while I'm walking a long IList in which its structure may ...

Access code in a View via reflection

I have an HtmlHelper CmsEntry that is used like this <%= Html.CmsEntry("stores.buyourstuff")%> This helper is used lots of times and I want to generate a list of all views that contain this helper. The list should contain the Viewname and the key ("stores.buyourstuff"). Is there a tool or some sample code that already does this? ...

Is it possible in Java to access private fields via reflection

Is it possible in Java to access private field str via reflection? For example to get value of this field. class Test { private String str; public void setStr(String value) { str = value; } } ...

Calling a F# function via a Linq expression tree MethodCallExpression node?

Hello, I am trying to create an expression tree containing a function call to a F# function on a certain module. However, I am missing something because the System.Linq.Expressions.Expression.Call() helper function cant find the function I'm supplying. The Call() call gives an InvalidOperationException: "No method 'myFunction' on type ...

Do languages with meta-linguistic abstraction perform better than those that just use reflection API for that?

Say, if I have a Lisp program, which uses (eval 'sym) and looks it up in its symbol-table does it actually perform better than something like aClass.getField("sym", anInstance) in "static" languages? ...

How do I obtain a list of all of the pages within an asp.net mvc project

How do I obtain a list of all of the pages within an asp.net mvc project for use in a dropdown list. I'd also like to obtain a list of all of the controls within that page. The problem is that I'd be calling this from a different project in the same solution. Can i use reflection for this???? ...

It's possible in Java to access the source code of a method "reflectively"?

Hi, I'm afraid that the answer is no, but maybe one of you surprises me. Thanks. Edit 1: I'm aware that the question doesn't make much sense but I think the point was understood and, sadly, the answer is no. Anyway I changed the title of the question adding quotes to the word "reflectively" and I will try to better explain my inte...

Is it possible to set private property via reflection

Can I set a private property via reflection? public abstract class Entity { private int _id; private DateTime? _createdOn; public virtual T Id { get { return _id; } private set { ChangePropertyAndNotify(ref _id, value, x => Id); } } public virtual DateTime? CreatedOn { get { return ...

C# print a delegate

Is there a simple way to print the code of a delegate at runtime ? (that "contains one method"). public delegate void SimpleDelegate(); SimpleDelegate delegateInstance = delegate { DoSomeStuff(); int i = DoOtherStuff() }; Now, I would like to display on the screen the body of delegateInstance. That is to say, doing someth...

Retrieve MethodInfo of a F# function

I would like to write a function that takes a function f as an argument and returns the System.Reflection.MethodInfo associated to f. I'm not quite sure if it is feasible or not. Thanks a lot. ...

.Net Reflection: find the parent 2 generations up the chain

I'm new to System.Reflection and I've stumbled on the following. I am using a third party executable, A, that has a custom interpreter engine class B that allows me to build simple 'tasks' that run on a mobile device. 'A' also has a class C that, when using A's default interface, shows a list of 'tasks' that are running within the inter...

How to implement a Properties window style control/system in Windows Forms?

So what I am trying to do is to have a set UI with certain controls, and I want to have some class instance to fill in the values. For instance: Classes that can populate the UI: Sharpen, Blur, Smear, ... : FilterBase So whenever the user creates an instances of the above classes, I want to automatically fetch the values based on th...

Shorten this reflection property name helper method?

Hi, I think the title says it all. I want a static helper method to remove magic strings. Of course, I could pack the property method inside the TestContainer, which would remove the need to provide the TestContainer as argument. This is done nicely here. But I would like to have the helper method in one static class, in case I later d...

How can I get delegates to property accessors from a generic type?

I'm currently building a node editor (as in Blender) and am having trouble getting delegates to property accessors from a generic type. So far the question here has brought me closest, but I'm having trouble that I think is specifically related to the type of object being generic. For reference, a "Node" is synonymous with an object, an...

Get pathes of assemblies used in Type

hi I need a method that takes a Type and returns the pathes of all assemblies that used in the type. I wrote this: public static IEnumerable<string> GetReferencesAssembliesPathes(this Type type) { yield return type.Assembly.Location; foreach (AssemblyName assemblyName in type.Assembly.GetReferencedAssemblies()) { yield return ...