ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Understanding Reflection, Part 1
Subject:   Reflection is great and all... BUT
Date:   2003-10-09 22:10:50
From:   neh123us@yahoo.com
Response to: Reflection is great and all... BUT

Both of these are good questions. As far as reflection and C# goes, anything you can do in C# you can do almost identically in VB.NET. The choice is really just a matter of which syntax you prefer.


As far as benefits to web developers ...


Consider this. Using reflection, you can write a function that will take as a parameter an object derived from System.Web.UI.Page and reflect on it to get the Properties associated with the page. This function could loop through these properties and use the set functions to initialize all of the controls on the page by matching the property name to the name of an element in a data source variable. You could also just as easily invoke the get functions in each of these properties to retrieve the data that the user entered. This provides a fairly nice way to implement a flexible method to initialize and retrieve the data on a web page.


This is only one example of using reflection to benefit web development. Please feel free to share other uses you are making of reflection.


1 to 1 of 1
  1. Reflection is great and all... BUT
    2003-10-11 09:42:36  anonymous2 [View]

1 to 1 of 1