System.ConsolePal.ConsoleColorToColorAttribute C# (CSharp) Méthode

ConsoleColorToColorAttribute() private static méthode

private static ConsoleColorToColorAttribute ( ConsoleColor color, bool isBackground ) : Interop.Kernel32.Color
color ConsoleColor
isBackground bool
Résultat Interop.Kernel32.Color
        private static Interop.Kernel32.Color ConsoleColorToColorAttribute(ConsoleColor color, bool isBackground)
        {
            if ((((int)color) & ~0xf) != 0)
                throw new ArgumentException(SR.Arg_InvalidConsoleColor);
            Contract.EndContractBlock();

            Interop.Kernel32.Color c = (Interop.Kernel32.Color)color;

            // Make these background colors instead of foreground
            if (isBackground)
                c = (Interop.Kernel32.Color)((int)c << 4);
            return c;
        }