Murugan.com
Murugan Andezuthu Dharmaratnam

  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  PHP   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  



mvc what is reflection


Home  > ASP.NET  > MVC  > mvc what is reflection 
       
Reflection provides objects (of type Type) that encapsulate assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, Reflection enables you to access them. For more information,

Reflection is accessing details of an object through the RTTI (run-time type information) - specifically Type; it is used primarily when you can't *possibly* know the specifics at compile-time, for example in data-binding (usually via System.ComponentModel as an intermediary) or some factory patterns: Reflection is useful in the following situations: ->For building new types at runtime. Use classes in System.Reflection.Emit. ->For performing late binding, accessing methods on types created at run time. See the topic Dynamically Loading and Using Types. ->When you need to access attributes in your program's metadata. See the topic Accessing Attributes With Reflection. ->For examining and instantiating types in an assembly. EXAMPLE Here's a simple example of Reflection using the static method GetType - inherited by all types from the Object base class - to obtain the type of a variable: C# Copy // Using GetType to obtain type information: int i = 42; System.Type type = i.GetType(); System.Console.WriteLine(type); The output is: System.Int32 In this example, Reflection is used to obtain the full name of a loaded assembly: C# Copy // Using Reflection to get information from an Assembly: System.Reflection.Assembly o = System.Reflection.Assembly.Load("mscorlib.dll"); System.Console.WriteLine(o.GetName()); CODE SNIPPET using System; class Foo { public string Bar { get; set; } public void DoSomething(string caption) { Console.WriteLine(caption + ": " + Bar); } } static class Program { static void Main() { Type type = typeof(Foo); object obj = type.GetConstructor(Type.EmptyTypes).Invoke(null); type.GetProperty("Bar").SetValue(obj, "Hello world", null); type.GetMethod("DoSomething").Invoke(obj, new object[] {"Reflection says"}); } }
index

mvc combobox ajax

What is MVC

MVC design pattern

Advantages of an MVC Based Web Application

Advantages of a Web Forms Based Web Application

Features of the ASP.NET MVC Framework

common used mvc namespace or mvc classes

mvc ActionLink return value from a textbox

MVC What does controller do

mvc how http request is processed

mvc Action Methods

MVC Return Types of mvc function or Action Retrun Types of an Action Method

mvc NonActionAttribute

MVC Partial Views

Helper Classes and Members for Rendering Views

What is MVC ViewDataDictionary

What is MVC Model

MVC Routing

MVC Helper Methods

mvc ActionLink

mvc routeValues

mvc what is reflection

asp net mvc passing data between controllers views and action methods

Create Mvc view by rendering data from differenet action methods

asp.net mvc dropdownlist example

How to publish MVC Application on web

mvc dropdownlist get selected text

asp .net mvc populate a dropdownlist from DataSet

asp .net mvc create a list selectlist from DataSet

asp .net mvc select options dropdownlist

Works on local machine System.ArgumentException Format of the initialization string does not conform to specification starting at index

mvc session timeout

iis mvc displays directory list and not application

iis mvc HTTP Error 50019 Internal Server Error section is locked at a parent level overrideMode

iis mvc error Could not load file or assembly System.Web.Mvc Version 2.0.0.0

SETTING UP THE DATABASE FOR MEMBERSHIP AUTHENTICATION IN MVC

One or more validation errors were detected during model generation

mvc authorize attribute does not store persist post data

asp .net mvc captcha

mvc Class Persistance Postback

Charts & Graphs Jquery plugin

Html.EditorFor Adding HTML Attributes



  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  PHP   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  

Copyright 2009 @ Murugan Andezuthu Dharmaratnam