We have a schema that we serialize and deserialize into an object hierarchy.
Some elements are optional in the schema. The xsd tool creates a cs file that inserts a property for each optional element. This property ends in "Specified", i.e. nameSpecified tells the serializer and deserializer to include the optional "name" element when processing.…
I have a generic Type as follows
public class TestGeneric<T>
{
public T Data { get; set; }
public TestGeneric(T data)
{
this.Data = data;
}
}
If i have now an object (which is coming from some external source) from which i know that it's type is of some closed TestGeneric<, but i don't know the TypeParameter T.…
I'm playing around with Reflection and I thought I'd make something which loads a class and prints the names of all fields in the class.
I've made a small hello world type of class to have something to inspect:
kent@rat:~/eclipsews/SmallExample/bin$ ls
IndependentClass.class
kent@rat:~/eclipsews/SmallExample/bin$ java IndependentClass
Hello!…
Hello,
I am trying to create Delegate for reading/writing properties of unknown type of class at runtime.
I have a generic class Main<T> and a method which looks like this:
Delegate.CreateDelegate(typeof(Func<T, object>), get)
where get is a MethodInfo of the property that should be read. The problem is that when the property…
For complete separation/decoupling, I've implemented a DAL in an assebly that is simply being copied over via post-build event to the website BIN folder. The website then on Application Start loads that assembly via System.Reflection.Assembly.LoadFile. Again, using reflection, I construct a couple of instances from classes in that assembly. I…
I have a grails project with some additional java source files under src/java folder. When compiling/running the server, the files under that directory get compiled into the project's target folder, together with all other groovy/grails classes. So far so good.
However, when I try to load one of the java source files (from src/java) using…
I'm working on a completion (intellisense) facility for C# in emacs.
The idea is, if a user types a fragment, then asks for completion via a particular keystroke combination, the completion facility will use .NET reflection to determine the possible completions.
Doing this requires that the type of the thing being completed, be known.…
Let's say I have some objects:
ArrayList<SomeObject> list = new ArrayList<SomeObject>();
SomeObject A = new SomeObject();
SomeObject B = new SomeObject();
SomeObject C = new SomeObject();
SomeObject D = new SomeObject();
These constructors automatically add each object to the ArrayList so I can iterate over them but still…
This is about a utility i have happened to write which can parse through the properties of a data contracts at runtime using reflection. The input required is a look like XPath string. since this is using reflection, you dont have to add the reference to any of your data contracts thus making pure generic and re- usable.. you can read…
I have a small contest problem in which is given a set of points, in 2D, that form a triangle. This triangle may be subject to an arbitrary rotation, may be subject to an arbitrary translation (both in the 2D plane) and may be subject to a reflection on a mirror, but its dimensions were kept unchanged.
Then, they give me a set of…
Hi,
I have a small contest problem in which is given a set of points, in 2D, that form a triangle. This triangle may be subject to an arbitrary rotation, may be subject to an arbitrary translation (both in the 2D plane) and may be subject to a reflection on a mirror, but its dimensions were kept unchanged.
Then, they give me a…
I am developing a product scrolling feature where products info( product image, Name, price)will be shown side by side horizontally. i need to show the image of the product and also its reflection. under the reflected image i need to show the Prod Name and its price.
The problem here is i dont want to show the complete…
Here's the scenario. I have VO (Value Objects) or DTO objects that are just containers for data. When I take those and split them apart for saving into a DB that (for lots of reasons) doesn't map to the VO's elegantly, I want to test to see if each field is successfully being created in the database and successfully…
Hi all,
I'm using sqlalchemy's reflection tools to get a Table object. I do this because these tables are dynamic and tables/columns can change. Here's the code I'm using:
def getTableByReflection(self, tableName, metadata, engine):
return Table(tableName, metadata, autoload = True, autoload_with = engine)
…
In the following code, I am getting a warning on reflection:
(ns com.example
(:import
[org.apache.commons.cli CommandLine Option Options PosixParser]))
(def *help-option* "help")
(def *host-option* "db-host")
(def *options*
(doto (Options.)
(.addOption "?" *help-option* false "Show this usage…
I got an example how to call oracle SP in iBATIS 3 without a map file.
And now I understand how to call it.
But I got another problem that how to get a result from output parameter(Oracle cursor).
A part of exception messages is "There is no setter for property named 'rs' in 'class java.lang.Class".
Below…
I got an example how to call oracle SP in iBATIS 3 without a map file.
And now I understand how to call it.
But I got another problem that how to get a result from output parameter(Oracle cursor).
A part of exception messages is "There is no setter for property named 'rs' in 'class java.lang.Class".
Below…
Hi,
Is it possible to obtain a list of functions declared in an unmanaged DLL? I want to create this list in a c# program.
Using dumpbin or System.Reflection.Assembly is not possible.
Thanks
LinqPad supports WCF Data Services. If you assign an URL, such as http://services.odata.org/Northwind/Northwind.svc/. It will list all available data objects and you can query them. I guess LinqPad generates all available data classes at run time by reflection.Emit.
I am wondering who can show me to how…
An extension of my previous thread: http://stackoverflow.com/questions/2634531/c-wrapping-an-application-within-another-application
So I'm launching embedded resource applications via Reflection and I'm unsure whether I can use AutoIt (.au3) files or not. People say it needs to be "Managed Code". I'm not…
I need to know what handlers are subsribed to the CollectionChanged event of the ObservableCollection class. The only solution I found would be to use Delegate.GetInvocationList() on the delegate of the event. The problem is, I can't get Reflection to find the compiler generated delegate. AFAIK the…
When logging in C#, how can I learn the name of the method that called the current method? I know all about System.Reflection.MethodBase.GetCurrentMethod(), but I want to go one step beneath this in the stack trace. I've considered parsing the stack trace, but I am hoping to find a cleaner more…
A friend of mine is working on a legacy VB6 project. I haven't touched that language in ten years, so I'm pretty rusty. Anyway, is there any kind of reflection API for VB6? Specifically, he needs a way to iterate the properties (and types) of a user-created Class. (In other words, not an…
Take the standard return statement for a controller:
return View("Index");
is there a way to make this thing compile time safe? using static reflection or some other trick?