How can I prevent anyone from holding a reference to an object in C#
- by floatingfrisbee
I have a class like this
internal class Report
{
public Company TargetCompany { get; private set; }
.... // other stuff
}
I do not want any one to be able to do this
Report r = GetReport();
Company c = r.TargetCompany;
but instead always use
r.TargetCompany
when they want access to the Company variable.
Is that possible? Does that even make sense?