Actually I would need 4 methodes. I'm using c# .NET 3.5 and windows forms.
Get ALL control properties (also sub properites like MenuItems etc.) from current form where name matches list name //don't works ok
Save results to XML //don't know how to save the results
Load result from XML and
finally set loaded control properties from XML...
Having a .NET assembly, how can I detect whether it was built for .NET CF or a full framework?
...
I'm writing a abstract file parser (C#) which is extended by two concrete parsers. Both need to perform several checks. Currently there is a validate method in the abstract parser, which uses reflection to call all methods with a name starting with 'test'. That way adding checks is as easy as adding a method with a name that starts with ...
Using reflection to obtain a MethodInfo, I want to test if the type returned is typeof System.Void.
Testing if it is System.Int32 works fine
myMethodInfo.ReturnType == typeof(System.Int32)
but
myMethodInfo.ReturnType == typeof(System.Void)
does not compile? At present Im testing if the string representation of the name is "Syste...
From within a method call I need to "jump" three layers up the stack and retrieve the type and value of the parameters passed to that method.
Getting the parameter type is easy but I couldn't find a way to get the value passed to a certain method on the stack.
var st = new StackTrace();
var frames = st.GetFrames();
var methodParameters ...
Dear ladies and sirs.
Observe the following simple source code:
using System;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
namespace A
{
public static class Program
{
private const MethodAttributes ExplicitImplementation =
MethodAttributes.Private | MethodAttributes.Virtual | Meth...
I'm working on a game engine in C#. The class I'm working on is called CEntityRegistry, and its job is to keep track of the many instances of CEntity in the game. My goal is to be able to query the CEntityRegistry with a given type, and get a list of each CEntity of that type.
What I'd like to do, therefore, is maintain a map:
private...
Basically what I need is to use the Type that i got using Type.GetType in a Generic Type,
is it possible, if yes how ?
I need something like this:
Type t = Type.GetType("mynamespce.a.b.c");
var x = GenericClass<t>();
Duplicate
...
Type.GetType("namespace.a.b.ClassName") returns null
and I have in the usings:
using namespace.a.b;
UPDATE:
the type exists, it's in a different class library, and i need to get it by string name
...
I have the understanding that perm size is used to store meta data, that would include byte code, static stuff etc.
My question how does usage of reflection affect the perm size, if it ever does.
I mean if Program-A uses normal way of running objects and Program-B uses reflection all over, how will the perm-sizes of the two programs com...
Let's assume we have the following class:
public class tx_fct
{
int _ok;
public int ok
{
get
{
return _ok;
}
set
{
_ok = value;
}
}
}
How can I override the getter using reflection?
The getter doesn't seem to be in tx_fct1.ok.GetType().GetMeth...
Does it needs reflection?
...
Hi,
I need to be able to retrieve the Custom Attributes of a class from a method in its base class. Right now I am doing it via a protected static method in the base class with the following implementation (the class can have multiple instances of the same attribute applied):
//Defined in a 'Base' class
protected static CustomAttribute...
Hello *,
I have the following use case: A table have a section, subsection or subsubsection heading like:
\section*{Table name}
\begin{tabular*} ...
\end{tabular*}
Because the table can appear in section, subsection etc. I thought I could define the table header and footer as macros and additionally pass the type of table...
I have an assembly qualified name of a type, e.g.
MyNamespace.MyClass, MyAssembly,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null
I want to extract the assembly full name, i.e.
MyAssembly, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
Obviously I could do this with simple string parsing, but is there a fr...
Hi,
I have 2 components as below
1) a windows service that reads DLL path, properties and functions from a config file and executes the function of the DLL using reflections.Assemply --- It works perfectly fine with any DLL (without DB connection). Idea is to create a windows service which will perform any task specified in the config ...
Hi,
I was wondering if it was possible in AspectJ to do the following. I’m adding a method .inspect() to every object of class RubyObject. That method is supposed to spit a string like #(CompleteClassName, var1=val1, var2=val2, …)
So far so good, this.getClass().getFields() gets me all the visible fields I want and this.getClass().getD...
This works fine for filtering out methods with the Analyze annotation:
for (Method m : ParseTree.class.getMethods()) {
if (m.isAnnotationPresent(Analyze.class)) {
What if I just want a count, without looping through? Is there some method that returns how many methods in a certain class have a certain annotation?
...
What is the difference between these calls?
...
When I research a new library, I sometimes find it hard to locate the implementation of a method.
In Java, Metho#getDeclaringClass provides the class that declared a given method. So by iterating over Class#getMethods, I can find for each method, the class that declared it.
In Scala, traits are converted to Java interfaces and a clas...