-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: rathod_s
Message 1 in Discussion
Hi, Topic: C#.NET i have a class as
public class VariableClass
{
public int varInt = 0;
public string varString = "stringVatiable";
public VariableClass()
{
varInt = varInt + 1;
varString = varString ;
}
public void MethodPublic()
{
}
}
I am creating an object of that class and trying to get the name of the
variables in the above class as
public class ClassVariableName : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
VariableClass theVariableClass= new VariableClass();
theVariableClass.MethodPublic();
int accessedVarInt = theVariableClass.varInt;
string accessedVarString = theVariableClass.varString;
string accessedVarStringName = (theVariableClass.varString);
}
Here in the second class i can get the values as "1" or ""stringVatiable" of
the varialbe defined in the "VariableClass" class(first).But what i want is the
name of the variables in the class "VariableClass".
ie. "varString " or "varInt "
I think i will have to deal with something like reflection but do not know how
to go for it.
My requirement for htis is , i have to create the datcolumn for a datgrid
whaose column names will be the name of the variable defined in a class.
Thanks.
Please reply soon,
-----------------------------------------------------------
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]