Table of Contents

Class ProxyDemo.EmailServiceAdapter

Namespace
PatternKit.Examples.ProxyDemo
Assembly
PatternKit.Examples.dll

Adapter that wraps a proxy to implement the ProxyDemo.IEmailService interface.

public sealed class ProxyDemo.EmailServiceAdapter : ProxyDemo.IEmailService
Inheritance
ProxyDemo.EmailServiceAdapter
Implements
Inherited Members
Extension Methods

Remarks

This demonstrates how proxies can be adapted to standard interfaces, enabling dependency injection and testability.

Constructors

EmailServiceAdapter(Proxy<(string to, string subject, string body), bool>)

Initializes a new instance of the ProxyDemo.EmailServiceAdapter class.

public EmailServiceAdapter(Proxy<(string to, string subject, string body), bool> proxy)

Parameters

proxy Proxy<(string to, string subject, string body), bool>

The proxy to wrap.

Methods

SendEmail(string, string, string)

Sends an email message.

public bool SendEmail(string to, string subject, string body)

Parameters

to string

The recipient email address.

subject string

The email subject.

body string

The email body content.

Returns

bool

true if the email was sent successfully; otherwise, false.