Tagged Questions
1
vote
1answer
38 views
Invoke a method using reflection with the “params” keyword without arguments
Just like this question I'm having issues invoking a method that has the "params" keyword. I keep getting TargetParameterCountException exceptions. "Parameter count mismatch".
The goal is to call ...
1
vote
2answers
44 views
Get Property Info from an object without giving the property name as string
For some reasons, I need to create a Dictionary of PropertyInfo instances corresponding to some class' properties (let's call it EntityClass).
Ok, I could use typeof(EntityClass).GetProperties().
...
0
votes
0answers
14 views
C# - Outlook Web Access - Use of Reflection
I am working on a project that a client logs into their Outlook Web Access via Internet Explorer. I have used the EWS Managed API 2.0 for C# ...
0
votes
0answers
28 views
About codedom and generic collection (list or dictionary)
its my first time using codedom, I have been successfull in using codeprimitiveexpression for setting a value to a variable until when the variable is a generic collection type. what alternative can ...
6
votes
1answer
48 views
How can I get current values of locals and parameters on the stack?
In a .NET application I have some points where I need to collect some debug info about the current thread state. I can obtain some information new StackTrace() constructor. In particular, I can get ...
0
votes
1answer
36 views
compiling several dll's from same project and getting different result
Hi i am wandering how can i achieve the fallowing:
I wish to compile a project several times to several dll's and by using them from other project to get different results.
The idea behind it is to ...
0
votes
0answers
8 views
Create object based on XmlChoiceIdentifier
I am creating objects dynamically using Activator(C#) and one of these classes looks like:
class Driver
{
Driver();
[XmlChoiceIdentifier("ItemElementName")]
[XmlElement("Bit16", ...
3
votes
2answers
44 views
Get Value of Field by string
I want to get the Value of a field of an object by using a string as variable name.
I tried to do this with Reflection:
myobject.GetType().GetProperty("Propertyname").GetValue(myobject, null);
This ...
2
votes
0answers
26 views
Dynamically Loaded Assembly - Settings & Communication
Ok so... I have a WPF application (let's call it Launcher.exe) which loads and executes another WPF application (let's call it Loaded.exe) dynamically using something like this:
Byte[] assemblyData;
...
0
votes
1answer
30 views
Reflection and Subclass
I have code
public static class A {
public static class B { }
public static class C { }
}
Am I using the reflection class A to find out what it contains subclasses? How to find out the ...
0
votes
1answer
23 views
How do I reflect custom attributes on a reference property without getting ones attached to the class?
Lets say I have:
[Description("Class Description")]
public class A { }
public class B {
public A PropertyA { get;set;}
}
When I reflect on PropertyA, I see the attributes of class A. Why?
...
0
votes
1answer
35 views
EntityCollection<T> to List<T> through Reflection
Im using reflection to get data dynamically (Entity types are defined at runtime). Im currently returning a single object whenever my currentObject hasn't 1:N relationships (via "First" generic method ...
0
votes
0answers
40 views
Issue when trying to get the delegate associated to a Control's event
I am trying to serialize controls to XML and I want to serialize their events' handler.
I am using this bit of code:
Control childCtrl = ....
if (childCtrl.GetType() == typeof(Button)) {
...
1
vote
4answers
44 views
Cast a variable to a Type and call Methods
How would I go about invoking a method call for an Object after casting it to a Type?
I have a KeyValuePair which stores the type of the object and the object itself. I then want to cast this object ...
1
vote
3answers
76 views
get assembly of method
Imagine the following situation:
Assembly A is starting the program. (it has a main method)
it loads Assembly B via reflection and instantiates a class of Assembly B.
in this instance a method is ...