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

Answer Posted / mohit jethva

You need to create a property with private field and make
property as public so you can access private field using
public property in other object.

eg.

private int _ID;

public int ID
{
get{return value;}
set{_ID = value;}
}

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define clr in .net?

557


Are string objects mutable or immutable?

523


Explain states of a thread in c#?

519


Why is main static in c#?

508


What is part of a method signature in c#?

461






Explain About sn.exe

495


Name some string escape sequences in c#.

561


Can destructors have access modifiers?

557


How do you clear a list in c#?

486


What is a int in c#?

457


What is difference between yielding and sleeping?

449


How to find methods of a assembly file (not using ILDASM)?

630


What is attribute c#?

427


Distinguish between a class and struct?

499


Why do we need generics?

511