-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Ambrose
Message 1 in Discussion
Hi All, I have Object which has member variables like mv1,mv1status,mv2,mv2status
etc.. I have to check for a Condition for mv1 and mv2 and change the Corresponding
status to true or false. I have asked my friend he has don it in Java using
Reflection. Can any body give the Similar version in C#. Thanks Anandraj.A.
class Bean
{
public boolean b1, b2, b3, b4;
}
import java.lang.reflect.*;
public class Test
{
public static void main(String str[])
{
try
{
Bean b = new Bean();
Class c = b.getClass();
for(int i = 1; i <= 4; i++)
{
System.out.println("b" + i + "=" + c.getField("b" + i).get(b));
}
for(int i = 1; i < 4; i++)
{
c.getField("b" + i).setBoolean(b,true);
}
for(int i = 1; i <= 4; i++)
{
System.out.println("b" + i + "=" + c.getField("b" + i).get(b));
}
}catch(Exception e)
{
e.printStackTrace();
}
}
}
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]