콘솔 메시지의 색을 변경할 수있는 구성을 만들려고합니다. 다음은 설정 여기C#은 JSON에서 ConsoleColor를 읽습니다. 코드는 어떻게 생겼을까요?
"ErrorColor": "Red",
색상을 변경할 수있는 설정은 없었다 전에이다.
Console.ForegroundColor = color == ConsoleColor.Black ? ConsoleColor.Red : color;
여기에 내가 추가하려고했던 것입니다.
Console.ForegroundColor = color == ConsoleColor.Black ? ConsoleColor.(session.LogicSettings.ErrorColor) : color;
내 코드는 어떻게 생겼습니까?
과 같을 것이다 (http://stackoverflow.com/questions/38884786/how-can-i-make-this-work-c- sharp-reads-consolecolor-from-json) 다른 질문에서 언급했듯이 [여기] 답변을 찾을 수 있습니다 (http://stackoverflow.com/questions/2290262/search-for-a-string-in-enum- and-return-enum), 이것은 기본적으로 마이크가 여러분에게 준 것입니다. –
나는 어떻게 내 코드가 – Mark