PrivateAccessor Class

Gives access to the non-public members of a type or instance. This class provides functionality similar to the one that exists in regular reflection classes with the added benefit that it can bypass essential security checks related to accessing non-public members through reflection.

Namespace: Telerik.JustMock
Assembly: Telerik.JustMock(in Telerik.JustMock.dll)


public sealed class PrivateAccessor : IDynamicMetaObjectProvider
Visual Basic
Public NotInheritable Class PrivateAccessor _
    Implements IDynamicMetaObjectProvider


When the profiler is enabled, PrivateAccessor acquires additional power: - It can even be used to access all kinds of non-public members in Silverlight (and when running in partial trust in general). - All calls made through PrivateAccessor are always made with full trust (unrestricted) permissions. You can assign a PrivateAccessor to a dynamic variable and access it as if you're referencing the original object: dynamic acc = new PrivateAccessor(myobj); acc.PrivateProperty = acc.PrivateMethod(123); // PrivateProperty and PrivateMethod are private members on myobj's type.

Inheritance Hierarchy

See Also

PrivateAccessor Members

Telerik.JustMock Namespace

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article