Click here to Skip to main content
15,886,689 members
Everything / Reflection

Reflection

reflection

Great Reads

by matt warren
Why is Reflection slow?
by n.podbielski
If you want to optimize code, which is based on Reflection, delegates may be the thing you are looking for. In this part are explained generic methods and events.
by Eric Lynch
Extends .NET reflection to decode the byte array returned by System.Reflection.MethodBody.GetILByteArray(), discusses the techniques to achieve this, and provides a brief primer on .NET reflection.
by Dev Leader
In this article, I’ll provide you with 4 simple code examples illustrating how reflection works in C#.

Latest Articles

by Dev Leader
In this article, I’ll provide you with 4 simple code examples illustrating how reflection works in C#.
by JBartlau
This article provides an overview of Visual Studio's integration of combit's report generator List & Label.
by Jaume González
Solution using reflection to dynamically load and execute C# code in a workflow context
by Bill Menees
Use .NET's TypeToTypeInfoMarshaler to get a full .NET type with member information from an IDispatch-based COM object.

All Articles

Sort by Score

Reflection 

4 Feb 2012 by Huisheng Chen
Using reflection to dynamically verify if an assembly is in debug or release compilation
29 Sep 2021 by benji_dv
How to clear all events is quite simple. It needs a finger of reflection...
2 Sep 2014 by DiponRoy
Let’s see how to make a simple model or Entity mapper using reflections in C#
1 Oct 2014 by Yuriy Magurdumov
PropertyMapper allows mapping object properties to string keys and accessing property values based on those string keys
17 Feb 2015 by PFalkowski
The way of calculating amount of memory occupied by some object in C#.NET
25 Jan 2012 by Dean Oliver
An alternative to Activator.CreateInstance
25 Jul 2014 by Kishor Deshpande
Methods which facilitate the conversion from string to value type
9 Jul 2012 by Matt T Heffron
This is an alternative for "Custom String FormatWith using Reflection"
18 Aug 2019 by rohitsies
CSV file generator using simplistic approach
7 Feb 2017 by discompsys
An easy way to allow local objects with direct access to invoke methods on a class, but prevent them from being part of the public API, for remote invocation.
14 Jul 2022 by Jaume González
Solution using reflection to dynamically load and execute C# code in a workflow context
21 Aug 2011 by murtaza dhari
A generic dropdown control using LINQ to SQL and Entities using Reflection
30 Aug 2011 by Ilka Guigova
Sample use of generics and type retrieval
26 Jan 2012 by Dean Oliver
The final solution after much debate and optimization:public class DynamicInitializer { static readonly Dictionary> list = new Dictionary>(); public static T New() where T : class { return New(typeof...
22 Feb 2013 by oppassum
Basic article to describe how to use Reflection for dynamically loading commands/etc
3 Oct 2016 by Metaphysico
Find Unit Tests that do not show up in test results.
25 Jan 2014 by Lumír Kojecký
This tip shows how to compile and use C# code during runtime and its impact on speed.
8 Feb 2014 by Shweta Lodha
INotifyPropertyChanged revisited with .NET Framework 4.5
7 Jan 2020 by honey the codewitch
Solve some common resource complications in .NET with this simple utility class
28 Jun 2016 by JohnX2015
This is a cross-platform general C++ engine, including a general runtime and a reflection engine.
20 Nov 2011 by Massimiliano Peluso "WeDev Limited"
Get Nested Property value using reflection and Linq.Expression
21 Aug 2011 by Itai Basel
This article shows how to automatically initialize/reset automatic properties' default values.
9 Feb 2015 by Bhis
Various ways to sort list and compare results
11 Dec 2011 by Handy Torres
Model Binder for ASP.NET Web Forms
6 Dec 2014 by saddam abu ghaida
This article describes how to convert any Data Table to List of Objects at runtime using Reflection
8 Dec 2014 by PIEBALDconsult
This is an alternative for "C# Convert DataTable to List of Objects Dynamically"
23 Aug 2011 by Richard Deeming
For .NET 4.0:using System;using System.Collections.Generic;using System.ComponentModel;using System.Reflection;using System.Linq.Expressions;static class AutomaticPropertyExtensions{ private static class Cache where T : class { public static readonly...
26 Jan 2012 by Andrew Rissing
Using expressions, you can achieve a faster result with less code.public static T New(){ Type t = typeof(T); Func method = Expression.Lambda>(Expression.Block(t, new Expression[] { Expression.New(t) })).Compile(); return method();}Furthermore, this can...
8 Apr 2011 by cechode
Saw this a while back; it's simpler (dirty and wrong but... ):public static T Get(Func getDelegate, bool DefaultTOnNull = false, T defaultVal = null) where T : class{ T result = null; try { result = getDelegate(); } catch...
5 Mar 2017 by DotNetSteve
Creating an extension class for View Models to save public properties using Generics and Delegates, replacing a reflection implementation
27 Mar 2012 by Henning Dieterichs
This tip shows how to get quickly all Information of an Assembly
14 Jun 2011 by Simon Bridge
Illustrates how to quickly and dynamically populate an object from a data-row
20 May 2013 by Sunil P V
How to access a 64bit registry key from 32bit built application in .NET 3.5 and lower
3 Nov 2015 by #realJSOP
This is an alternative for "Compareing Two Complex objects of same class"
1 Jul 2014 by JIANGWilliam
This article introduces a handy way to get the calling Testing Assembly from a called Assembly
5 May 2020 by honey the codewitch
This tip shows you a robust way to get the type of items a collection can hold. It works with non-generic collections too.
15 Jul 2011 by Kelqualyn
Same thing 10-100 times faster.Additionally, IndexMap can be built only once per DataTable.using System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Linq.Expressions;using System.Reflection;namespace ReflectiveReader{ public static...
15 Sep 2015 by Moe Farag
While writing tests for methods that use .NET Reflection, I found out that Rhino doesn't expose stubbed method for reflected invocation.
11 Mar 2014 by Jaume González
To inherit an Entity Framework class, to extend it, bind to data and unmap it from DBContext.
5 Jul 2012 by Sumit Chawla
Custom String FormatWith using Reflection
30 Nov 2011 by mohanaitec
WinForm DataGridView loading from ObjectCollection.
20 May 2012 by abhinav_soni
This article provides alternative to Java's Proxy class with bytecode manipulation.
4 Jan 2015 by farhad2161
In this article we will implement a general Parcelable class and name it ParcelableEntity. Then all other entity class can extend it, then they will be parcelable too. So there is no need to implement Parcelable class for other classes.
2 Jan 2016 by rvjagadheesh
A complete assembly reference tool for .NET which will display details on all methods, properties, enum for all classes in all namespaces
12 Mar 2015 by ThiagoTane
This is an alternative for "Simple Model/Entity Mapper in C#"
9 Jan 2016 by Farhad Taghavi Azar Sharabiani
This code makes a mechanism to implement some tasks for executing on Application-Start from anywhere.
1 Apr 2017 by Bjørn
How to automatically initialize a class for an inherited class instance
31 Jan 2012 by Yves Vaillancourt
And why don't you just do this?public static T Create() where T : class, new(){ return new T();}
13 Jun 2016 by Pavel Kabir
This tip is about how to get collect the values for all instance fields of a given type.
15 Oct 2013 by jolsen
How to get a reference to a class member when all you have is its name and type.
31 Jan 2012 by Jonathan Jandrell
I've tried a few different ways to dynamically create an object of 'unknown' type.This is my final, simple result: public static T Create() { Type type = typeof(T); return (T)type.Assembly.CreateInstance(type.FullName); ...