Questions tagged [system.reflection]

System.Reflection is a namespace of the .NET framework. It contains types that retrieve information about assemblies, modules, members, parameters, and other entities in managed code by examining their metadata.

System.Reflection is a namespace of the .NET framework. It contains types that retrieve information about assemblies, modules, members, parameters, and other entities in managed code by examining their metadata.

References

1116 questions
-1
votes
1 answer

Read a method's inner calling method names from 'MethodInfo' Class using reflection

I was reading all properties and methods from a class using reflection. So i want to identify a method's inner calling methods using reflection. I tried to read MethodBody using 'GetMethodBody()' method. But it is listing only local variables. So…
Ajo George
  • 15
  • 5
-1
votes
1 answer

SDK to extract code out of .net assembly to recreate the source code?

Is there a SDK I can use to extract code out of .net assembly to recreate the source code?
user3845056
  • 489
  • 7
  • 25
-1
votes
1 answer

Generic Editor Template

Is it possible to create a generic view with System.Reflection ? So I could loop throught the class properties creating inputs with the @Html.EditorFor or @Html.Editor or even a normal . With this I could create a template and re-use it…
Lucas
  • 1,259
  • 15
  • 25
-1
votes
1 answer

C# Generic Type Inheritence

Is it possible to create a generic class which the generic type T will be the base class of it? i.e: MyClass b1 = new MyClass(); MyClass b2 = new MyClass(); b1.Name="test"; b2.ID=1; Base Classes: class Base1 { …
eakgul
  • 3,658
  • 21
  • 33
-1
votes
1 answer

ArrayList from Class with Reflection

I need to use Reflection for this problem. Just a simple code needed written in ASP.net and reflection. Reflection is a must. Please take a look attached file for more info and example. I just want to make the code below working. Output does not…
Serkan
  • 1
  • 2
-1
votes
2 answers

How to get a property value using Reflection if the property name is defined as "name"

I have the following code to compare two collections to one another... //code invocation CollectionComparer comp = new CollectionComparer("name", "ASC"); this.InnerList.Sort(comp); class public class CollectionComparer : IComparer { …
bastos.sergio
  • 6,684
  • 4
  • 26
  • 36
-1
votes
2 answers

Why cast from MemberInfo to MethodInfo is allowed?

Documentation for System.Reflection.MemberInfo has the following example: foreach (MemberInfo mi in t.GetMembers()) { if (mi.MemberType == MemberTypes.Method) { foreach (ParameterInfo pi in…
newprint
  • 6,936
  • 13
  • 67
  • 109
-1
votes
1 answer

How to get all the static classes from all the loaded assemblies in an app-domain and invoke a static method using reflection

my requirement is as follows, is this possible ? if yes can someone please point me to any resources on this ? get all the assemblies which end with the word "static" from an app domain get hold of the static class which ends with the word …
nen
  • 621
  • 2
  • 10
  • 26
-1
votes
1 answer

Conditionally Skip method Execution using .NET Reflector

We can execute a method using .NET reflector. But is there any way to skip a specific step based on some condition while executing a method? For Example : public fn1() { int a=1,b=2,c=3; //Step1 a=b; //Ste2 b=c; //Step3 c+=1; } These…
SabarishV
  • 13
  • 3
-1
votes
2 answers

'System.Boolean' cannot be converted to type 'System.Reflection.RuntimePropertyInfo'

I have a class which is created dynamically .I have another existing class which has data so i am trying to map existing class data to to dynamicaly created class propeties. But all the fileds in dynamic class are showing their types as…
Chandra Mohan
  • 729
  • 2
  • 10
  • 29
-1
votes
3 answers

Can an exception be fully recreated?

Going along the same ideas found in this question. I need to be able to recreate an exception inside a function that doesnt know ahead of time what kinds of exceptions will be passed in. My code so far: //Code where original exception in…
Jeremy Lin
  • 400
  • 3
  • 13
-1
votes
1 answer

TypeSwitching in C#

I took the following code from http://blogs.msdn.com/b/jaredpar/archive/2008/05/16/switching-on-types.aspx static class TypeSwitch { public class CaseInfo { public bool IsDefault { get; set; } public Type Target { get; set; } …
ashutosh raina
  • 9,228
  • 12
  • 44
  • 80
-2
votes
1 answer

ActiveX Assembly ReflectionTypeLoadException

I created an activeX exe (registered with regasm.exe) that loads a DLL with Dim a As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(FullPath) This DLL works with an Interface "PSInterface". As normal exe it works, but when i call…
Fabian
  • 9
  • 5
-2
votes
1 answer

C# Invoke a non-static method of an instance by string

I have been struggling with a the concept mentioned in the title. I've done a good deal of research and have found some good examples and I have attempted to implement some of them but have reached a road block. I initially had a class that looked…
-2
votes
1 answer

C# Reflection Get List of Object

I have a problem fetching object from the array object that I made. It seems it didn't fetch the object see my code below: Product Model public class Product { public string Id { get; set; } public List ShortDesc { get; set; } //…
Alvin Quezon
  • 1,089
  • 3
  • 11
  • 29