I am trying to find all of the types in the Models namespace within an ASP.NET MVC assembly from within a testing assembly. I was trying to use LINQ to find the relevant set for me but it is returning an empty set on me. I am sure it is some simple mistake, I am still relatively new to LINQ admittedly.
var abstractViewModelType = typeof...
I've been searching for this for quite a while with no luck so far. Is there an equivalent to Java's ClassFileTransformer in .NET? Basically, I want to create a class CustomClassFileTransformer (which in Java would implement the interface ClassFileTransformer) that gets called whenever a class is loaded, and is allowed to tweak it and re...
I'm new to Lua and dealing with Lua as a scripting language in an alpha release of a program. The developer is unresponsive and I need to get a list of functions provided by some C++ objects which are accessible from the Lua code.
Is there any easy way to see what fields and functions these objects expose?
...
Hi people. I have a question about reflection
I am trying to have some kind of eval() method. So i can call for example:
eval("test('woohoo')");
Now I understand the there is no eval method in java but there is reflection. I made the following code:
String s = "test";
Class cl = Class.forName("Main");
Method method = cl.getMethod(s,...
i am receiving the follwing error when i am invoking a custom object
"Object of type 'customObject' cannot be converted to type 'customObject'."
Following is the scenario when i am getting the error
i am invoking a method in a dll dynamically.
Load an assembly
CreateInstance....
calling MethodInfo.Invoke() passing int, string as a ...
I have properties called reel1, reel2, reel3, and reel4. How can I dynamically reference these properties by just passing an integer (1-4) to my method?
Specifically, I am looking for how to get an object reference without knowing the name of the object.
In Javascript, I would do:
temp = eval("reel" + tempInt);
and temp would be eq...
Does anyone knows a tool for Java (something like codedom for C#) that provides a way to generate Java code to a .java file?
EDIT:
I'm building a plataform that its main objective his to automate an operation. Giving some input, i want to generate code for an external tool. So it isn't generation on runtime. I want to generate and outpu...
To give an idea of my requirement, consider these classes -
class A { }
class B {
String m_sName;
public String Name {
get { return m_sName; }
set { m_sName = value; }
}
int m_iVal;
public int Val {
get { return m_iVal; }
set { m_iVal = value; }
}
A m_objA;
public A AObj...
I know that .NET assembly is self-descriptive because of the metadata. Now suppose I have a black-box assembly which I know nothing about. Could I find out the types contained in it and use their methods and pass arguments? How? Sampe code snippets will be deeply appreciated.
[New Edit1]
I am not working at design time. I am trying to ...
through java reflection how to check that method name is in camelCase?
e.g.
import java.lang.reflect.*;
public class TestClass {
private int simpleMethod(
Object p, int x) throws NullPointerException
{
if (p == null)
throw new NullPointerException();
return x;
}
public st...
Can someone compare and contrast Reflection and KERMIT? Do they do the same thing? Which is better? Why? We may need to use one of these at my business and we are looking for input.
Thanks
W
...
I have an application that uses plugins that are managed via an interface I then dynamically load the plugin classes and cast them to the interface to work with them.
I have the following line of code, assume that IPlugin is my interface.
IPlugin _plugin = (IPlugin)Activator.CreateInstance(oInfo.Assembly, oInfo.FullyQualifiedName)
Th...
Let's say I have a struct that contains local environments:
public struct Environments
{
public const string Dev = "DEV";
public const string Qa1 = "SQA";
public const string Prod1 = "PROD";
public const string Prod2 = "PROD_SA";
public const string Uat = "UAT";
}
And I'd like to pull...
Hello,
I need to get the value of a field with a specific annotation, So with reflection I am able to get this Field Object. The problem is that this field will be always private though I know in advance it will always have a getter method. I know that I can use setAccesible(true) and get its value (when there is no PermissionManager), ...
The title pretty much says it all, how do I know if I'm getting a compiler generated backingfield for a {get; set;} property ?
I'm running this code to get my FieldInfos:
Class MyType
{
private int foo;
public int bar {get; private set; }
}
Type type = TypeOf(MyType);
foreach (FieldInfo fi in type.GetFields(BindingFlags.Instan...
Hi,
I know its unlikely but I was wondering if there is any way to get the comments (i.e. the bits after the ''') of a class or property..? I have managed to get a list of properties of a class using the PropertyInfo class but I cant find a way to get the comments / description.. I need it for a guide I am writing for the administrators...
Hi,
many questions are close, but none answers my problem...
How do I use reflection in C# 3.5 to get all classes which are static from an assembly. I already get all Types defined, but there is no IsStatic property. Counting 0 constructors is really slow and did not work either.
Any tips or a line of code? :-)
Chris
...
Say I have this class Myclass that contains this method:
public class MyClass
{
public int MyProperty { get; set; }
public int MySecondProperty { get; set; }
public MyOtherClass subClass { get; set; }
public object clone<T>(object original, T emptyObj)
{
FieldInfo[] fis = this...
Ok i have a problem, sorry if i cant explaint it clear but the code speaks for its self.
i have a class which generates objects from a given class name;
Say we say the class is Modules:
public function name($name)
{
$this->includeModule($name);
try
{
$module = new ReflectionClass($name);
$instance = $module->i...
An extension of my previous thread: http://stackoverflow.com/questions/2634531/c-wrapping-an-application-within-another-application
So I'm launching embedded resource applications via Reflection and I'm unsure whether I can use AutoIt (.au3) files or not. People say it needs to be "Managed Code". I'm not completely sure what that means ...