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

How is lazy loading achieved?

983


How do I declare inout arguments in c#?

980


Why do we use threads in c#?

1039


Can you store different types in an array in c#?

1003


What is COM Interoperability?

1017


What does char mean in c#?

1001


Explain dataset.acceptchanges method in .net?

1013


What is the use of 'as' Keyword in C# ?

1066


What is _viewstart cshtml?

958


Can a abstract class have a constructor?

936


What is the difference between method overriding and method overloading?

1008


how background thread access to ui control?

1101


Which is the best language for desktop application?

1017


Explain the difference between access specifier and access modifier in c#?

1039


Why do we use namespace in c#?

1003