I'm writing a XML (de)serializer using Text.XML.Light and Scrap your Boilerplate (at http://github.com/finnsson/Text.XML.Generic) and so far I got working code for "normal" ADTs but I'm stuck at deserializing existentials.
I got the existential data type
data DataBox where
DataBox :: (Show d, Eq d, Data d) => d -> DataBox
and I'm t...
I need it in FlexUnit to test private methods. Is there any possibility to do this via reflection by using describeType or maybe flexUnit has some build in facility? I dislike artificial limitation that i cannot test private functions, it greatly reduces flexibility. Yes it is good design for me to test private functions, so please do no...
I'm working on a completion (intellisense) facility for C# in emacs.
The idea is, if a user types a fragment, then asks for completion via a particular keystroke combination, the completion facility will use .NET reflection to determine the possible completions.
Doing this requires that the type of the thing being completed, be know...
This may be a fairly subjective question, but maybe not.
My application contains a bunch of forms that are displayed to the user at different times. Each form is a class of its own. Typically the user clicks a button, which launches a new form.
I have a convenience function that builds these buttons, you call it like this:
buildButto...
Hi
I'm new to java.
I'm trying to use some dynamically loaded classes in my application.
The application doesn't know classes , Just it try to load a class by name that its name came from input.
It doesn't know class (So I can't use casting) but just needs to call some methods of that class (every class should have that methods).
I thoug...
This one is really pissing me off. Here goes:
My goal is to load assemblies at run-time that contain embedded aspx,ascx etc. What I would also like is to not lock the assembly file on disk so I can update it at run-time without having to restart the application (I know this will leave the previous version(s) loaded).
To that end I hav...
Hello. We have encountered some strange things while calling reflected generic delegates. In some cases with attatched debuger we can make impossible call, while without debugger we cannot catch any exception and application fastfails.
Here is the code:
using System;
using System.Windows.Forms;
using System.Reflection;
namespace Gener...
Hello,
According to MSDN MethodRental Class allows to change method body of dynamic modules. However because of its limitations I cannot think of practical usages for it. Google did not help me either.
Any ideas what the class can be used for?
...
Given the class':
public abstract class AbstractEntity
{
public virtual Guid Id { get; private set; }
}
public class Entity
{
public virtual Guid Id { get; private set; }
}
And a PropertyInfo for the property 'Id'.
When calling the method:
PropertyInfo.GetAccessors()
It returns both the get-method and the set-method when ...
When I am loading an Assembly dynamically, then calling a method from it, I appear to be getting the method from Assembly executing before the code in the method that is calling it. It does not appear to be executing in a Serial manner as I would expect. Can anyone shine some light on why this might be happening. Below is some code to...
Is there a way to find out the name of derived class from a base class instance?
e.g.:
class A{
....
}
class B extends A{
...
}
class c extends A{
...
}
now if a method returns an object of A, can I find out if it is of type B or C?
...
I have the code that reflects enum (DictionaryType) option to Guid in very straight-forward way
if (dictionaryType == DictionaryType.RegionType)
return Consts.DictionaryTypeId.RegionType;
if (dictionaryType == DictionaryType.Nationality)
return Consts.DictionaryTypeId.Nationality;
Please, suggest me the best way to reflect En...
I have some business classes which implements IBusinessRequest<T>, for example:
public class PersonBusiness : IBusinessRequest<Person>
{ }
Besides this I have a function:
TypeHelper.CreateBusinessInstance(Type businessType, Type businessRequestType)
A requirement of a business class is that they must have a parameterless construct...
Disclaimers:
I am not interested in doing this in any real production code.
I make no claim that there's a good reason why I'm interested in doing this.
I realize that if this is in any way possible, it must involve doing some highly inadvisable things.
That said... is this possible? I'm really just curious to know.
In other words, ...
basically I need to get a constant for a class however I have no instance of the object but only its class.
In PHP I would do constant(XYZ);
Is there a similar way of retrieving a constant in JAVA?
I need it to facilitate a dynamic getMethod call
Class parameterType = Class.forName(class_name);
object.setProperty(field name, field valu...
I have an ASP.NET MVC 2 application in which I am creating a custom action filter. This filter sits on the controllers in the application and verifies from the database whether that function is currently available.
Public Overrides Sub OnActionExecuting(ByVal filterContext As System.Web.Mvc.ActionExecutingContext)
Try
' Check con...
I have a number of classes all in the same interface, all in the same assembly, all conforming to the same generic interface:
public class AppleFactory : IFactory<Apple> { ... }
public class BananaFactory : IFactory<Banana> { ... }
// ...
It's safe to assume that if we have an IFactory<T> for a particular T that it's the only one of t...
How can I load a class that is already on the class path, instantiate it, and also instantiate any inner classes defined within it?
EG:
public class TestClass {
public class InnerClass { }
}
...
I need to determine the COM component(unmanaged code) type and invoke the exposed interface's methods using reflection in C# at runtime.
First What member of "Type" tells that type is COM component and we can take CLSID at runtime? Is Type.COMObject?
I need to call methods of exposed interfaces as they called in unmanaged code using C...
Is there a way to reflect on an interface to detect variance on its generic type parameters and return types? In other words, can I use reflection to differentiate between the two interfaces:
interface IVariant<out R, in A>
{
R DoSomething(A arg);
}
interface IInvariant<R, A>
{
R DoSomething(A arg);
}
The IL for both looks the...