I have a reflection method finds all the types in a namespace:
var models =
Assembly.GetAssembly(application).GetTypes().Where(
@t => @t.Namespace == typeof(ViewModelNamespaceBeacon).Namespace).OrderBy(@m => @m.Name).ToList();
My problem is I'm returning an Anonymous type with the name of:
{Name = "...
Ok, i don't think this is possible so I thought I would ask to make sure. I'm in the process of creating a function which reflects over the properties in a class and adds them to this data structure I have. Some of the properties are generic types.
So say we have DataType(Of T) that has a .Value property of type T:
Dim properties = Ge...
Hi - I'm a bit new to reflection in c#. I'm trying to generate a list of all controllers in order to test whether or not they are decorated with a specific actionfilter. When writing unit tests, how do you access the tested assembly?
This does not seem to work:
var myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
...
I'm currently learning D, and one of the things I've wondered about is whether D has a way of duplicating the code generation capabilities of JVM languages.
Here's a scenario:
I have an object, and I want to generate a string based on that object that gives it's name and all its fields. In Java/Scala, I could just use reflection, but su...
Hello the 'flow!
I wish to call something similar to
public static void Foo()
{
PropertyInfo prop = xxx;
}
from
public string Bar()
{
get { return Foo(); }
}
I want prop to be the PropertyInfo for the calling property, I am at a loss as to what xxx would be.
Any ideas folks?
Kindness,
Dan
...
Lets say i have a Proxy to an object, can I somehow get access to the object via reflection or other technique ?
...
Within my C++/QtTestLib Class, how can I get a count of the number of private functions in this class so that I can output it at runtime?
...
Here's what I am working with:
Part of my project is a windows form app. I want to basically capture every event that fires and has listeners. So some button's click event, some checkbox's check event, everything on a basic "Control" event list. So that event still fires, but also fires my event.
Is there a generic "some event fired" ...
Hi,
How can I call the method of an object that has already been loaded in the JVM using reflection?
I tried
Class myClass = Class.forName("myClass");
Method m = com.test.class.getDeclaredMethod("getValue",new Class[] {});
Object result = m.invoke(myClass,null);
but i get java.lang.IllegalArgumentException: object is not an instance ...
This puzzles me. I have a class with a custom annotation and I can't seem to verify that the annotation is present. What am I doing wrong here? If I run MyOperationTest (see below), I get this as a result:
implements Library.Operation: true
has @Library.Marker: false
Tada!
Library.java:
package com.example.gotchas;
public class Li...
How do I get the actual type of T in a generic List at run time using reflection?
...
Hi how do i call System.Reflection.MethodInfo.Invoke() with paramters with threads.
For instance..
Say I have a method that allows you to pass in a string that represents a
class name and calls corresponding class method dynamically , now i want to
call this Methodinfo.invoke with threads ,I have no idea how to do this since i am call...
I want to retrieve private (implementation and other) methods of a class which implements an interface and also is derived from (inherits) a base class.
How can I achieve this using reflection?
Is there anyother way to achieve this?
This is wat m tryin to do. I need to view these private methods and their contents, I don't want to in...
I get the Type but that's not the same as the Class which is what I'm looking for.
Is there an inverse operation of typeof?
EDIT
I need the class in order to use a generic repository:
GenericRepository<BaseEntity> repository = new GenericRepository<BaseEntity>(new AzureBrightData());
I started by writing BaseEntity from which all e...
<AttributeUsage(AttributeTargets.Property)> _
Private Class CustomAttrib
Inherits Attribute
Public Property DataTypeLength As Integer
End Class
Private Class TestClass
<CustomAttrib(DataTypeLength:=75)> _
Public Property MyProp As String
End Class
Dim properties = GetType(TestClass).GetFields(Reflection.BindingFla...
I have a class with a Items property, which is an IList:
class Stuff {
IList<OtherStuff> Items;
}
I want to be able to receive a string within a method (I thought of this format originally: Items[0]) and be able to retrieve the first item of the Items list.
I tried this:
object MyMethod(string s, object obj) {
return obj.Get...
Is it possible to merge two assemblies at runtime such that, when you iterate over the ExportedTypes, all the types from both original assemblies are returned?
The why:
I use a database migration framework to update my databases. It take a single assembly made up of special classes which defines the modifications made to the database....
I know - 2007 is outdated - but I can't switch to the newer controls at the moment.
I've figured out that the TreeView is not showing properly in IE8 because of an internal function:
RadTreeView.AlignImage=function(_4e){
_4e.align="absmiddle";
_4e.style.display="inline";
if(!document.all||window.opera){
if(_4e.nextSibling&&_4e.nextSibl...
Let's say I have a class that looks like this:
public class CallByAttribute
{
[CodeName("Foo")]
public string MyProperty { get; set; }
[CodeName("Bar")]
public string MyMethod(int someParameter)
{
return myDictionary[someParameter];
}
}
How would I call these two properties or methods, using CodeName ...
Is it possible? With reflection or any other way?
...