-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Karthikeyan_P
Message 2 in Discussion

Hi Buddy,

You need to use reflection.


Getting type information with System.Type
The System.Type class is the cornerstone of .NET's Reflection API. With it,
you can glean any information about a type you could possibly need. All
types inherit a GetType method from System.Object, which returns a Type
object representing that type's definition. It's also possible to create a
Type without an instance variable by passing the type's fully qualified name
(e.g., System.Threading.Thread) to the static Type.GetType method.

The Type class contains methods that determine a type's base class, whether
or not the type is a reference or value, and any methods, properties, or
fields the type exposes. See Table A for a selected list of these methods.
Table A
Method/property  Explanation  
IsClass  Returns true if this type is a reference type or class 
 
IsValueType  Returns true if this type is a value type 
 
IsArray  Returns true if this type is an array 
 
IsCOMObject  Returns true if this type is a COM object 
 
IsInterface  Returns true if this type is an interface 
 
IsSubclassOf  Returns true if this type is a subclass of the Type object
passed to the method 
 
Namespace  Returns a string representing the fully qualified namespace this
type is contained in 
 
GetConstructors  Returns an array of ConstructorInfo objects representing
all constructors declared for the type 
 
GetMethods  Returns an array of MethodInfo objects representing all methods
declared for the type 
 
GetEvents  Returns an array of EventInfo objects representing all events
declared for the type 
 
GetFields  Returns an array of FieldInfo objects representing all fields
declared for the type 
 
GetInterfaces  Returns an array of Type objects representing all interfaces
implemented by the type 
 
GetMembers  Returns an array of MemberInfo objects representing all members
(methods, fields, properties, and constructors) of the type 
 
GetProperties  Returns an array of PropertyInfo objects representing all
properties declared for the type 
 
InvokeMember  Allows the programmer to invoke a method on the type by name 
 
 
Important Type information methods




Regards,
Karthikeyan.P.

-----Original Message-----
From: rathod_s [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 05, 2005 8:40 PM
To: BDOTNET
Subject: C#.net

-----------------------------------------------------------

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]




-----------------------------------------------------------

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]
  • Re: C#.net Karthikeyan_P

Reply via email to