Hi,
Here's the situation:
I'm attempting to get a collection of all types in my assembly that implement a specific generic interface along with the generic type parameters used. I have managed to put together a Linq query to perform this but it seems awfully redunant.
I've read up on let and joins but couldn't see how to I'd use them t...
case as followed:
in the project a
public class X1
{
public string Name="X1";
}
public class X2
{
public string GetName(string name)
{
return "";
}
public string GetName(string name,ref X1 x1)
{
return "";
}
}
question:
how to get 'GetName' MethodInfo by reflection's getmethd function in other project
...
Hello,
further to my previous question, I have a new problem now, I want to get a property which is an array :
string propertyName="DisplayLayout.Bands[0].Columns";
PropertyInfo pi = control.GetType().GetProperty(propertyName)
But actually, it returns null.
Best Regards,
Florian
Edit : Sorry for the lack of precision :$ I access to...
hey all,
I need to call the Non default constructor when using assembly.CreateInstance. how?
...
Probably simple but could not figure out. I am loading an assembly at runtime and browsing through some classes and generating input controls for its properties. To create an instance of an object at runtime I am using:
object o = PropertyType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, ...
class CustomerMessage
{
private string name;
private Dictionary<MethodBase, object> changeTrackingMethods =
new Dictionary<MethodBase, object>();
public int Id { get; set; }
public string Name {
get { return this.name; }
set
{
this.name = value;
this.PropertyChang...
Any programming language that does not have a suitable reflection mechanism I find seriously debilitating for rapidly changing problems.
It seems with certain languages its incredible hard or not possible to do:
Convention over Configuration
Automatic Databinding
AOP / Meta programming
with out reflection.
Some example languages th...
I want to use reflection to get and set properties etc. I know how to do this for an object I instance myself using Activator.CreateInstance(), but how do I attach to an already running process in memory and do the same thing?
...
having the method
public void foo(){
//..
}
Is there a way to get the methodName (in this case foo) at runtime?
I know how to get the classname via
this.getClass().getName()
or to get all public methods via
Method[] methods = this.getClass().getMethods();
Once I have the method name the parameters would also be important...
I'm trying to extend the JMF implementation for custom data sources in a custom environment.
My JMF implementation is packed to a jar file (only class files, all obfuscated).
The JMF's package manager uses reflection to instantiate a class.
It looks into one of the following packages for the desired class: javax, com.sun, com.ibm.
All t...
Hi,
I'm having difficulty with my project and deploying it on my web hosting provider.
I'm on a shared hosting environment with "Host Level" trust.
I have used LINQ in my project but now they've just told me that Reflection is disabled on their shared services. I believe that reflection is required to be able to use variables within th...
Hey all,
I'm working with reflection and when I get the parameters' list of a method, I need to examine all of them, when I find any one which its type is an array I need to avoid it, I mean array of any kind, so I used the following which doesn't work:
(!(parameter.GetType().Equals(Array)))
The error was that I'm using a type as a v...
Hello,
The situation seems to be abnormal, but I was asked to build serializer that will parse an object into string by concatenating results of "get" methods. The values should appear in the same order as their "get" equivalent is declared in source code file.
So, for example, we have
Class testBean1{
public String getValue1(){
...
The code snippet below causes this warning in NetBeans 6.9.
[rawtypes] found raw type: org.openide.nodes.PropertySupport.Reflection
missing type parameters for generic class org.openide.nodes.PropertySupport.Reflection<T>
Property dataProp = new PropertySupport.Reflection(t, dataStore.getFloat3DClass(),
wo...
Hey all,
I have a problem with this:
objectType.GetMethod("setValues").Invoke(testClass, arguments);
arguments is an array of objects, can any member of it be an array of any type like this int[]???
I'm asking this because I have an exception when passing arguments with an int[] array as a member in it, this is the exception:
System....
Hey all,
I have a Loaded assembly and I need to define an instance from its type, I don't mean using the following:
object t = assembly.CreateInstance(...)
I need something like this:
typeof(assembly.CreateInstance(..).getType()) newObject
but this is wrong, how can I accomplish that?any fast suggestions??
...
I have two assemblies A.exe and B.exe. Both are Windows.Forms .net 3.5 assemblies. A.exe knows that B.exe is in the same directory.
How can I find out the ProductName of B.exe from A.exe?
...
How to I reflect back the name of a type that is supplied as a generic parameter? I would really like to know how this is done in both C# and VB.NET. See the following example code and expected response.
In C#:
public void Test<T>()
{
Console.WriteLine("The supplied type is {0}",???)
}
In VB.NET
Public Sub Test(Of T)()
...
I have a survey that's stored in a large object graph of variable depth, depending on how many sections and sub-sections the user chooses to create. I need to be able to search through all the properties for each object in the object graph and see if that property's .ToString() contains a certain keyword that's being searched for.
Can I...
I have a Doctrine_Collection object that was created with code that looks something like.
$collection = Doctrine_Query::create()
->from('FooBazBar')
->where('widget_id = ?',$some_var)
->execute();
Short of writing it down somewhere, is it possible to to retrieve the where clause that was used to create the collection?
That is, I want...