Skip to main content

Proxy

  • Chapter
  • First Online:
Design Patterns in .NET Core 3
  • 660 Accesses

Abstract

When we looked at the Decorator design pattern, we saw the different ways of enhancing the functionality of an object. The Proxy design pattern is similar, but its goal is generally to preserve exactly (or as closely as possible) the API that is being used while offering certain internal enhancements.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Not that it matters for this particular example, but this implementation is not thread-safe. Imagine two threads that both do a null check, pass it, and then both assign bitmap one after another – the constructor will be called twice. This is why we use System.Lazy, which is thread-safe by design.

  2. 2.

    You can get it from NuGet; the source code is at https://github.com/ekonbenefits/impromptu-interface.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Dmitri Nesteruk

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Nesteruk, D. (2020). Proxy. In: Design Patterns in .NET Core 3. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-6180-4_13

Download citation

Publish with us

Policies and ethics