✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public class TimeoutDecorator : ICommand
{
private readonly ICommand _inner;
private readonly int _ms;
public TimeoutDecorator(ICommand c, int ms) => (_inner, _ms) = (c, ms);
public bool Execute()
{
var t = new Thread(_inner.Execute);
t.Start();
return t.Join(_ms);
}
}
Чому Decorator з тайм‑аутом корисний?