System.Char.IsUpper C# (CSharp) Méthode

IsUpper() public static méthode

public static IsUpper ( char c ) : bool
c char
Résultat bool
        public static bool IsUpper(char c)
        {
            unsafe
            {
                var value = (ushort)c;
                return value >= 65 && value <= 90;
            }
        }

Same methods

Char::IsUpper ( string s, int index ) : bool

Usage Example

        /// <summary>
        /// Breaks apart an event key into the individual and normalized key and
        /// any modifiers.
        /// </summary>
        /// <param name="evt">The evt.</param>
        /// <param name="key">The key.</param>
        /// <param name="modifiers">The mod.</param>
        public static void DecomposeKeys(
            EventKey evt,
            out Key key,
            out ModifierType modifiers)
        {
            // Use the keymap to decompose various elements of the hardware keys.
            uint keyval;
            int  effectiveGroup,
                 level;
            ModifierType consumedModifiers;

            keymap.TranslateKeyboardState(
                evt.HardwareKeycode,
                evt.State,
                evt.Group,
                out keyval,
                out effectiveGroup,
                out level,
                out consumedModifiers);

            // Break out the identified keys and modifiers.
            key       = (Key)keyval;
            modifiers = evt.State & ~consumedModifiers;

            // Normalize some of the keys that don't make sense.
            if (key == Key.ISO_Left_Tab)
            {
                key        = Key.Tab;
                modifiers |= ModifierType.ShiftMask;
            }

            // Check to see if we are a character and pull out the shift key if
            // it is a capital letter. This is used to normalize so all the
            // keys are uppercase with a shift modifier.
            bool shiftWasConsumed = ((evt.State ^ modifiers) & ModifierType.ShiftMask)
                                    != 0;
            var unicode = (char)Keyval.ToUnicode((uint)key);

            if (shiftWasConsumed && Char.IsUpper(unicode))
            {
                modifiers |= ModifierType.ShiftMask;
            }

            if (Char.IsLetter(unicode) &&
                Char.IsLower(unicode))
            {
                key = (Key)Char.ToUpper(unicode);
            }
        }
All Usage Examples Of System.Char::IsUpper