✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public class RetryDecorator : IService
{
private readonly IService _inner;
private readonly int _max;
public RetryDecorator(IService inner, int max = 3) => (_inner, _max) = (inner, max);
public bool Execute()
{
for (int i = 0; i < _max; i++)
if (_inner.Execute()) return true;
return false;
}
}
Чому це Decorator, а не Proxy?