While l was looking over some questions about MEF, I stumbled onto this particular answer to a question. It made me wonder about such a bit since I've never had to attempt such but can see it being very valid in the scenario of that question.
Scenario:
If you have a directory of various .Net Assemblies all named different, how would yo...
I need to be able to instantiate an object of a class in Dojo at runtime and mix it into another object (kind of like specifying an extends or an implements in Java, but at runtime). and I came up with the following solution:
var declaredClassBackup = this.declaredClass; // backup the "declaredClass"
var mixinObject = null;
try {
...
I have various projects that use reflection to access and invoke private or internal members in some of the framework classes.
These projects all work fine on my machine (running visual basic express 2008), but are they guaranteed to work on another machine, or, say, over a network?
I've had a look at ReflectionPermission, but I'm not ...
I am currently developing an application where you can create "programs" with it without writing source code, just click&play if you like.
Now the question is how do I generate an executable program from my data model. There are many possibilities but I am not sure which one is the best for me. I need to generate assemblies with classes...
In my limited experience, it seems that a common idiom is to pass objects from one layer to another using a "mapper". An ORM is one example, to go map from the Domain to the database and back. Automapper is another, which facilitates mapping from a rich domain object, into an object consumable by another layer (ViewModel, WebService.
So...
I am using reflection along with linq.Dynamic, and I am having a small problem with creating a query that needs to get IQueryable<T> from an IList<T> or ISet<T> when I currently have an object.
At first I thought I could write a little helper method:
object Helper<T>( IList<T> list, string query, param object[] values )
{
... do quer...
The class to instantiate:
public class InstantiateMe
{
public String foo
{
get;
set;
}
}
Some pseudo-code:
public void CreateInstanceOf(Type t)
{
var instance = new t();
instance.foo = "bar";
}
So far I'm figuring that I need to use reflection to get this done, given the dynamic nature of what I...
How do you get the name of a generic class using reflection
eg
public class SomeGenericClass<T>
{
}
SomeGenericClass<int> test = new SomeGenericClass<int>();
test.GetType().Name returns "SomeGenericClass'1"
How do I get it to return "SomeGenericClass" without the '1?
...
Given this method:
public final void foo (List<MyClass> bar){ .. }
I want to be able to call this method reflectively. In order for getMethod to work, I have to change it to:
public final void foo (List bar){ .. }
This does not seem right for obvious reasons, but no combination of inputs to getMethod seem to work otherwise. I have ...
What I'm trying to do is create a domain model with a Plain Old PHP Object.
The I'm creating a library which will do all the infrastructure stuff.
So one of my models looks like this
class Project {
public $id;
public $name;
public $typeId;
private $type;
public function getType() {
return $this->type;
}
public func...
Hi,
This is a fairly generic question in that I'm just wondering what potential options there are for this.
Say, I have a simple class:
Public Class Example
Private _One As String
Public Property One() As String
Get
Return _One
End Get
Set(ByVal value As String)
_One = val...
I hava a delegate
public delegate void Context();
And i had implemented it by anonymous method,
public Context fakeHttpContext = () =>
{
...
create fake http context.
};
I dont' want to execute the fakeHttpContext by
fakeHttpContext.Invoke()
I wonder if i could invoke it by ...
For a really abstract application I am creating, I need to call methods without knowing their parameter types and only knowing the parameters in a String shape.
Let say I have the method;
getNames(String like, int amount);
and I have a array of strings containing the 2 parameters, so lets say I have;
String[] params = new String[] {...
I know it sounds like a stupid question, but how safe is your API if you can access private properties and change them?
...
Here's the deal:
I have a report designer where users can create reports based on some predefined datasets. They can select a set of columns to include in the report and then, when the report is ran, an IList is created by mapping the NHibernate collection over to the dto class collection using automapper.
The problem with this is tha...
In other words, if I have a compiled dll file, is there a way to find out (using Reflection) whether this dll is produced from a WebApplication, ClassLibrary or another project type? Is there any difference at all?
...
Is it possible to use AS3 reflection to find out if a method was overridden?
I need a method like:
protected function isOverriden(methodName:string) : bool
{
//magic here!
//...
return awesomeLocalVariable;
}
So, I pass in the method name as a string and the isOverridden method yields true only if and only if the object...
I have a class with a property that can be an Image (i.e. an IMG element) or a Canvas. When I serialize it to JSON, I need to convert this to a text string. If it is a Canvas, then I can call Canvas#toDataURL. But if it is an Image, I first need to draw it to a Canvas with Canvas#drawImage, then serialize that canvas with toDataURL.
So ...
I am working on a team project in Java. One requirement is that we dynamically populate a drop-down menu of all classes that implement a certain interface. New classes can be added after compile time. To accomplish this we are using reflection.
Problem: All of the drop-down menus are blank on my system. I cannot for the life of me figur...
I work at an in-house IT department for company running 10 or so only shops of varying complexity. The shops code has been written over the last 8 years, each shop a new branch growing father and father away from the stem (I guess that makes it a bush?)
The need for more and more complex discounts, campaigns and user monitoring are grow...