Best practice for constant string for implementations to use
<p>Say I have an interface: </p>

<pre><code>public interface IFeature
{
    Task execFeature();
}
</code></pre>

<p>and two implementations:</p>

<pre><code>public class FirstFeature : IFeature
{
    private IWebApi webApi;
    public FirstFeature(IWebApi webApi)
    {
        this.webApi = webApi;
    }

    public async Task execFeature()
    {
        string response = await webApi.getClassName();
        IResult result;
        if(response==null)
            result = new TextResult("Error accessing api - check internet connection/api address");
        else
            result = new TextResult("Hello dear user – the selected class name is " + response);
        result.display();
    }
}

public class SecondFeature : IFeature
{
    private IWebApi webApi;
    public SecondFeature(IWebApi webApi)
    {
        this.webApi = webApi;
    }

    public async Task execFeature()
    {
        List&lt;string&gt; classNames = new List&lt;string&gt;();
        var classNameTasks = Enumerable.Range(1, 3).Select(i =&gt; webApi.getClassName()).ToArray();
        classNames.AddRange((await Task.WhenAll(classNameTasks)));
        IResult result;
        if (classNames[0] == null)
            result = new TextResult("Error accessing api - check internet connection/api address");
        else 
            result = new TextResult("Hello dear user – we’ve selected three new class names for you, and they are " + classNames[0] + ", " + classNames[1] + ", and " + classNames[2]);
        result.display();
    }
}
</code></pre>

<p>As you can see, in both implementations I <strong>had</strong> to do the <code>result = new TextResult("Error accessing api - check internet connection/api address");</code> line to report the error.</p>

<p>What is the best practice in OOP/Good Design to have a constant <code>error_string</code> that I can access in all of my implementations? </p>

<p>the way it is right now, code is duplicated.</p>