Hi everyone. I'm having trouble emitting a call to a delegate whose type is unfinished at the time of the emit. I'll elaborate: I've declared the following delegate type:
// Delegate type. The 'firstArgument' will be 'this', i.e., this is an open
// instance method: the implicit argument is here given explicitly, in
// 'firstArgument'. ...
Hi all,
I am passing one parameter/object to the function "RefValTest(object oIn)" by the value but after function call is over object passed by the value is changed, that shoud not happened, right ?
class MilanTest
{
public int SomeValue { get; set; }
}
class PR
{
public static object RefValTest(ob...
I'm retrieving an IEnumerable list of properties via following code:
BindingFlags bindingFlag = BindingFlags.Instance | BindingFlags.Public;
var dataProperties = typeof(myParentObject).GetProperties(bindingFlag);
Then I'm iterating through the list and retrieving the value for each property.
I've come across two different approach...
I'm asking this out of curiosity rather than due to a real need to know, but I can't think of any good reasons for MethodInfo.Invoke to wrap its exceptions.
Were it to let them pass unwrapped, debugging such exceptions in Visual Studio would be a tiny bit easier - I wouldn't have to ask VS to stop on first-chance exceptions to see the c...
I have a Person and an Organisation Entity:
Person looks like this:
public class PersonEntity
{
public string FirstName {get;set;}
public string LastName {get;set;}
public bool IsValid(PersonEnum Attribute, string AttributeValue)
{
if(attribute == PersonEnum.FirstName && AttributeValue == null)
return false;
if(attribute == PersonEnum....
Hello,
I'm writing an application that runs "things" to a schedule.
Idea being that the database contains assembly, method information and also the parameter values. The timer will come along, reflect the method to be run, add the parameters and then execute the method.
Everything is fine except for the parameters.
So, lets say the m...
I wish to write a reusable library for querying against AD with LDAP. I'm using both ActiveDs COM objects and System.DirectoryServices.
Greatly inspired by Bart de Smet LINQ to AD, I have written a SchemaAttribute and an DirectoryAttributeAttribute classes to use with a DirectorySource(Of T) class (Yes, it's VBNET, but any C# code will ...
I want to pass an optional data parameter to some callbacks, but only to callbacks that support a single parameter; right now, I have a moderately-sized code base of callbacks that cannot accept a parameter at all. How can I check what parameters a Function object supports?
...
Given a class like this:
public class A : B<C> {...}
Assume that I know how to find A's class type using reflection. How can I figure out at run time what base class it extends (in this case B)?
...
Take this sample class as an example:
[AttributeUsage(AttributeTargets.All, AllowMultiple=true)]
public class BugFixAttribute : System.Attribute
{
public int BugId { get; private set; }
public string Programmer { get; private set; }
public DateTime Date { get; private set; }
public string Comments { get; set; }
...
Hi,
I am trying to use the MethodInfo MakeGenericMethod as follows:
foreach (var type in types)
{
object output = null;
var method = typeof (ContentTypeResolver).GetMethod("TryConstruct");
var genmethod = method.MakeGenericMethod(type);
var arr = new object[] { from, outpu...
I am writing a system which requires me to fetch the values of properties in an object, preferably using reflection. This project is for the xbox360, which runs on the compact framework and thus has a slow garbage collector - this means it's absolutely vital that I avoid allocations!
The only way I have found to do this is:
Foo Somethi...
Hi all,
I didn't quite get / see what I was hoping for and maybe missed, so I'll ask again anyhow.
I have a class with fields on it. I have a data table that I'm querying from with the same columns and corresponding data types. I have a string array of all fields I am concerned about, and their specific order.
What I want to do is cy...
This question arose when I was trying to figure out a larger problem that, for simplicity sake, I'm omitting.
I have to represent a certain data structure in C#. Its a protocol that will be used to communicate with an external system. As such, it has a sequence of strings with predefined lengths and integer (or other, more complicated d...
I am currently implementing a basic raytracer in c++. Works pretty well so far, matte materials (with ambient and diffuse brdf) work as expected so far.
Adding specular highlights would result in the full Phong Model and that's exactly what i tried to do.
Unfortunately, i encounter gamut overflow, with all kinds of values for the specu...
I'm attempting to map values of properties (via reflection) between different objects. This appears to be failing oddly on nullable value types. The following code:
destProperty.SetValue(destObject, sourceProperty.GetValue(sourceObject, null), null);
sets destProperty to null if destProperty is a nullable value type, despite sourcePr...
hi,
i use java reflections to get methods used in a class.I also want to get the variables name and their types used in those methods.How can i do that?Help
...
I Have a main dll Main.dll with 2 files MyBaseClass.cs and MyScript.cs both with namespace MainProject:
public class MyBaseClass
{
public string name ;
public MyBaseClass()
{
name = "base class" ;
}
}
Next i've made a second dll addOn.dll (using MainProject) with namespace SubProject
public class MySubClas...
The project I'm working on needs some simple audit logging for when a user changes their email, billing address, etc. The objects we're working with are coming from different sources, one a WCF service, the other a web service.
I've implemented the following method using reflection to find changes to the properties on two different obj...
Hi!
I'm doing a Java Record/Replay tool and I need to launch Java applications from my main Java app.
I need access to the EventDispatchThread in order to intercept the events and record them, so I'm launching the application through reflection with (code snippet simplified):
Class<?> app = Class.forName(mainClass);
Method m = app.get...