I have a unhandled exception handler (an oxymoron if ever there was one) but I'd like to get more information out of it.
At the moment it logs the exception message, stack trace etc. and recursively does the same for any inner exceptions. However often the exception is a derived type of the exception class and therefore I do not know a...
Hello Everyone,
I'm trying to make an Dynamic Menu in GWT, reading it from an XML file. The XML file must have the button name and the action (the composite associated that will be added to an Horizontal Panel).
To make the action, a need to do Reflection of the Class, wish is given me a lot of problems. I've tried 2 different solution,...
Possible Duplicates
Taking out all classes of a specific namespace
Getting all types in a namespace via reflection
Excuse me. How to get all classes within namespace?
...
I want to check if an object o is an instance of the class c or of a subclass of c.
For instance, if p is of class Point I want x.instanceOf(Point.class) to be true and also x.instanceOf(Object.class) to be true.
I want it to work also for primitive types. For instance, if x is an integer then x.instanceOf(Integer.class) should be true.
...
I want to write a method that uses Reflection to tell whether a given Type implements IList<T>. For example:
IsGenericList(typeof(int)) // should return false
IsGenericList(typeof(ArrayList)) // should return false
IsGenericList(typeof(IList<int>)) // should return true
IsGenericList(...
I want to supply unknown "object" and return the value of one of its members. Response is required in C#.
Generically I guess I'm looking for the code to this method
public static object GetObjectMemberValue (object myObject, string memberName)
More specifically I'm doing this for resource strings in Silverlight and need to write this...
I'm working on implementing a reflection mechanism in C++.
All objects within my code are a subclass of Object(my own generic type) that contain a static member datum of type Class.
class Class{
public:
Class(const std::string &n, Object *(*c)());
protected:
std::string name; // Name for subclass
Object *(*create)(); // Po...
I'm trying to write a function to generate the full C# declaration for a Type object. My current method involves performing very manual and specific logic on the Type object.
Is there some built in way to .Net to generate this declaration?
As an example, take this class:
namespace My.Code.Here
{
public class Class1<>
{
pub...
This is driving me nuts. Perhaps I'm missing something obvious?
The fieldInfo.FieldType is correct (DateTime), and the value I'm applying is also a DateTime.
for(int i=0; i<objectArray.Length; i++)
{
FieldInfo destinationField = GetFieldInfo(i);
object destinationValue = objectArray[i];
destinationField.SetValue(this, des...
Hi All,
I am implementing a piece of Java software that will hopefully allow for C libraries as plugins. In order to call these future functions I need to somehow create a native function in Java from which I can call the code that doesn't exist yet.
The method signature will be static but the method and class names may change.
I am ...
Is there a way to change private static field of an alien class?
For example:
package mx.managers {
public class TooltipManager ... {
private static var _impl:IToolTipManager2; // <- assign my own value here
...
}
}
In Java it is possible to do it using Reflection API. What about Flex?
...
How can I determine by reflection if the type of an object is defined by a class in my own assembly or by the .NET Framework?
I dont want to supply the name of my own assembly in code, because it should work with any assembly and namespace.
...
I wish to create a class in Python that I can add and remove attributes and methods. How can I acomplish that?
Oh, and please don't ask why.
...
I have a following code which works fine
MsgBox(AddSomething(Of String)("Hello", "World"))
Public Function AddSomething(Of T)(ByVal FirstValue As T, ByVal SecondValue As T) As String
Return FirstValue.ToString + SecondValue.ToString
End Function
Now we are redesigning the application to work with parameters of different types whi...
Take a look at setAccessible - a way in Java to let you call private methods by reflections. Why didn't .NET implement such a feature yet?
...
I have an application that is written in C#
I want to display a list of COM components in a folder on the system with details about the component, initially the ProgID.
Is there a way of interrogating a component from my C# code to find out the details at runtime.
...
I have a handful of assemblies on a network share. There is another application that uses reflection to load these and execute some code. The method that needs to be executed makes a web request, so I am getting a security exception when I try to do that. I have tried signing the assemblies, but that doesn't work. Does anyone have any th...
I'm hoping someone can point in the direction of some useful information pertaining to the best practices surrounding the use of Reflection in Java.
The current project I'm supporting uses Oracle ADF Faces and we've found that based on the objectives at hand certain pages end up with a vast number of components which need to be initiali...
Let's say we've got these two classes:
public class Derived : Base
{
public Derived(string s)
: base(s)
{ }
}
public class Base
{
protected Base(string s)
{
}
}
How can I find out from within the ctor of Base that Derived is the invoker? This is what I came up with:
public class Derived : Base
{
public ...
In C# can I cast a variable of type object to a variable of type T where T is defined in a Type variable?
...