Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Is there any way to access private memebers of an object
from another object?

Answer Posted / porchelvi.a

We can achieve this by using Reflection.
By using Reflection we can access some information about
object at runtime.even we can invoke private method of an
object by using Reflection.

Example :

Class Student
{
private int RollNo;
public string Name;
}
class MainClass
{
Type type=typeof(Student); //to get type information
MemberInfo[] mem=type.getMembers();
foreach(Memberinfo m in mem)
//we can get every member here
}

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is xslt in c#?

866


what is a destructor?

986


What are extension methods and where can we use them?

887


Explain how to add controls dynamically to the form using c#.net.

980


Distinguish between system.string and system.text.stringbuilder classes?

934


Why reflection is used in c#?

937


Can You Prevent Your Class From Being Inherited By Another Class?

942


How do you mark a method obsolete?

1004


Why do we use yield in c#?

917


What is garbage collection? How to force garbage collector to run?

902


What is an assembly qualified name

1055


what are implementation inheritance and interface inheritance?

934


Which class does the remote object has to inherit?

1061


What is readline c#?

890


What is string pool in c#?

994