At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about 20-30 different web applications and corresponding services.
...
How would you dynamically subscribe to a C# event so that given a Object instance and a String name containing the name of the event, you subscribe to that event and do something (write to the console for example) when that event has been fired?
It would seem using Reflection this isn't possible and I would like to avoid having to use R...
I have wondered about the appropriateness of reflection in C# code. For example I have written a function which iterates through the properties of a given source object and creates a new instance of a specified type, then copies the values of properties with the same name from one to the other. I created this to copy data from one auto-g...
Recently I was talking to a co-worker about C++ and lamented that there was no way to take a string with the name of a class field and extract the field with that name; in other words, it lacks reflection. He gave me a baffled look and asked when anyone would ever need to do such a thing.
Off the top of my head I didn't have a good ans...
Hi,
I am not sure whether is it possible to change attribute's parameter during runtime? For example, inside an assembly I have the following class
public class UserInfo
{
[Category("change me!")]
public int Age
{
get;
set;
}
[Category("change me!")]
public string Name
{
get;
...
Is there a way of getting all required assemblies (excluding the .net framework) for a .net project into a folder ready to be packaged into an nsis as setup file?
I've tried writing a small console app that uses reflection to get a list of dlls but have got stuck with finding a foolproof way of determining if a dll is from the .net fram...
How can I tell from the assemblyName, or Assembly class (or others like it), whether an assembly is part of the .net framework (ie System.windows.Forms)?
So far I've considered the PublicKeyToken, and CodeBase properties, but these are not always the same for the whole framework.
Edit: The reason I want this info is to get a list of ...
Is there a way to get the path for the assembly in which the current code resides? I do not want the path of the calling assembly, just the one containing the code.
Basically my unit test needs to read some xml test files which are located relative to the dll. I want the path to always resolve correctly regardless of whether the tes...
using reflection , I need to investigate a user DLL and create an object of a class in it.
what is the simple way of doing it ?
...
I would like to do the equivalent of:
object result = Eval("1 + 3");
string now = Eval("System.DateTime.Now().ToString()") as string
Following Biri s link, I got this snippet (modified to remove obsolete method ICodeCompiler.CreateCompiler():
private object Eval(string sExpression)
{
CSharpCodeProvider c = new CSharpCodeProvid...
It's shown that 'as' casing is much faster than prefix casting, but what about 'is' reflection? How bad is it? As you can imagine, searching for 'is' on Google isn't terribly effective.
...
Using reflection, I need to load 2 different versions of the same assembly. Can I load the 2 versions in 2 different AppDomains in the same process?
I need to do some data migration from the old version of the app to the new version.
Please let me know if this is possible or should I use 2 separate processes.
...
I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use.
What I'm after is basically pointing the application at an assembly and choosing a given class from which to select properties that should be included in an exported HTML form as fields....
Say I have an ASMX web service, MyService. The service has a method, MyMethod. I could execute MyMethod on the server side as follows:
MyService service = new MyService();
service.MyMethod();
I need to do similar, with service and method not known until runtime.
I'm assuming that reflection is the way to go about that. Unfortuna...
What is the difference between Introspection and Reflection in .NET
...
I would like to be able to obtain all the parameter values from the StackFrame in .NET. A bit like how you're able to see the values in the CallStack when in the VS debugger. My approach has concentrated on using the StackFrame class and then to reflect over a ParamaterInfo array. I've had success with reflection and properties, but this...
Note: I am using .Net 1.1, although I am not completely against answer that use higher versions.
I am displaying some dynamically generated objects in a PropertyGrid. These objects have numeric, text, and enumeration properties. Currently I am having issues setting the default value for the enumerations so that they don't always appear ...
Edit - New Question
Ok lets rephrase the question more generically.
Using reflection, is there a way to dynamically call at runtime a base class method that you may be overriding. You cannot use the 'base' keyword at compile time because you cannot be sure it exists. At runtime I want to list my ancestors methods and call the ancestor...
How to get all the classes in a namespace through reflection in C#
...
How to get all implementations of an interface through reflection in C#
...