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