RationalDev

more of an aspiration than a claim

C#: Constant String From a Constant Char

Have you ever wanted to use a char as a constant string and tried something similar to below, but can’t because const string must be valid at compile time?

    const string AcceptCommand = Keys.Enter.ToString();

The closest I have found on how to do this is:

    private static readonly AcceptCommand = Keys.Enter.ToString();