473,473 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

reflection uses

hi
could any one tell me which real life senarios reflection can be used in ?
thnx
Jul 21 '05 #1
5 4014
guy
the VS.NET debugger :-)

"Frazer" wrote:
hi
could any one tell me which real life senarios reflection can be used in ?
thnx

Jul 21 '05 #2
sure ....

how about default serialization of objects ?

how about the databinding of classes to display objects ?

by being able to get the description of an object one can do many things ...

Greg
"Frazer" <Fr****@hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
hi
could any one tell me which real life senarios reflection can be used in ?
thnx

Jul 21 '05 #3
what can i use it for.
I just want to create some samples of reflection.
I have created a utility.
i have a class and some methods have an attribute called "Storedprocedure"
which takes as a parameter the stored procedure name .
i then use reflection to find out those methods that have these attributes.

and check if the db has those stored procedures or someone has accidently
deleted them.

this is quite useful. but i cant think of any other ways that i can use
reflection.
what do u mean by default serialization of objects?
and how about the databinding of classes to display objects ?
can u elaborate a bit more thanx?

"Greg Young" <gr********@planetbeach.com> wrote in message
news:#t*************@TK2MSFTNGP10.phx.gbl...
sure ....

how about default serialization of objects ?

how about the databinding of classes to display objects ?

by being able to get the description of an object one can do many things ....
Greg
"Frazer" <Fr****@hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
hi
could any one tell me which real life senarios reflection can be used in ? thnx


Jul 21 '05 #4
Create a simple console application that defines a IPlugin interface of
some kind, say something like this:

public interface IPlugin
{
void PerformSomeAction(System.IO.TextWriter output);
}

Then create "class library" assemblies that have classes that implement
said interface:

public class HelloWorldPlugin : MyConsoleApplication.Whatever.IPlugin
{
public HelloWorldPlugin()
{
}

public void PerformSomeAction(System.IO.TextWriter output)
{
output.WriteLine("Hello, World!");
}
}

public class GoodbyeWorldPlugin : MyConsoleApplication.Whatever.IPlugin
{
public GoodbyeWorldPlugin()
{
}

public void PerformSomeAction(System.IO.TextWriter output)
{
output.WriteLine("Goodbye, cruel... cruel... World!");
}
}

Then use reflection to load those assemblies at run-time, and call the
PerformSomeAction() method on the classes, passing Console.Out or
something along those lines.

Something like that?

Good luck,
Sean

Frazer wrote:
what can i use it for.
I just want to create some samples of reflection.
I have created a utility.
i have a class and some methods have an attribute called "Storedprocedure"
which takes as a parameter the stored procedure name .
i then use reflection to find out those methods that have these attributes.

and check if the db has those stored procedures or someone has accidently
deleted them.

this is quite useful. but i cant think of any other ways that i can use
reflection.
what do u mean by default serialization of objects?
and how about the databinding of classes to display objects ?
can u elaborate a bit more thanx?

"Greg Young" <gr********@planetbeach.com> wrote in message
news:#t*************@TK2MSFTNGP10.phx.gbl...
sure ....

how about default serialization of objects ?

how about the databinding of classes to display objects ?

by being able to get the description of an object one can do many things


...
Greg
"Frazer" <Fr****@hotmail.com> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
hi
could any one tell me which real life senarios reflection can be used in
?
thnx



Jul 21 '05 #5
Reflection..

One of the things I have used reflection for was to create a better Comparer. The comparer I created alows me to sort my own custom collection based on a string array of fields. Works really well

Another thing I use reflection for is for Generic validation. Most of my business objects have custom attributes such as "Required", Min/Max Values etc that are retrieved by reflection from an Extender control. This allows me to bind business objects directly to the UI and still define these requirements in a single central location.

These are just some of the places I use reflection almost every day.
--
Eddie de Bear
MCSD
"Frazer" wrote:
hi
could any one tell me which real life senarios reflection can be used in ?
thnx

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ichor | last post by:
hi i have read a few examples that use the System.Reflection api , but i cant understand in what way is it helpful. i mean its practical use in the real world thanx
4
by: Tim Werth | last post by:
I am trying to use reflection to add an event handler for the RowUpdated event of the OracleDataAdapter object (ODP.NET), but the same thing can be said for SqlDataAdapter if you only use...
2
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
2
by: Mark | last post by:
Am I out of my mind if I use Reflection everytime someone logs into our site to get and track the current Major/Minor/Build/Revision version that the person is viewing our site through? This...
0
by: MWells | last post by:
I have a simple VS.NET solution with Project "A" as a web app and Project "B" as a class library. "B" does some HTML rendering, and uses reflection to locate and load the necessary rendering...
5
by: Frazer | last post by:
hi could any one tell me which real life senarios reflection can be used in ? thnx
5
by: DesCF | last post by:
What exactly is Reflection ? I've looked at the definition in Help but I don't find it very helpful! I just stare at it blankly and can't quite seem to grasp its meaning conceptually. Reflection...
6
by: Cralis | last post by:
Hi guys, Someone once said, 'You can do that with reflection'. I can't recall what it was I was trying to do at the time, but then he said, 'Any developer knows what reflection is...'. I kept...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.