Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / ConsoleKeyInfo.cs / 1 / ConsoleKeyInfo.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: ConsoleKeyInfo ** ** ** Purpose: This value type represents a single key press, with modifier keys ** like Alt, Control, and Shift. ** ** =============================================================================*/ namespace System { [Serializable] public struct ConsoleKeyInfo { private char _keyChar; private ConsoleKey _key; private ConsoleModifiers _mods; public ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool control) { // Limit ConsoleKey values to 0 to 255, but don't check whether the // key is a valid value in our ConsoleKey enum. There are a few // values in that enum that we didn't define, and reserved keys // that might start showing up on keyboards in a few years. if (((int)key) < 0 || ((int)key) > 255) throw new ArgumentOutOfRangeException("key", Environment.GetResourceString("ArgumentOutOfRange_ConsoleKey")); _keyChar = keyChar; _key = key; _mods = 0; if (shift) _mods |= ConsoleModifiers.Shift; if (alt) _mods |= ConsoleModifiers.Alt; if (control) _mods |= ConsoleModifiers.Control; } public char KeyChar { get { return _keyChar; } } public ConsoleKey Key { get { return _key; } } public ConsoleModifiers Modifiers { get { return _mods; } } public override bool Equals(Object value) { if (value is ConsoleKeyInfo) return Equals((ConsoleKeyInfo)value); else return false; } public bool Equals(ConsoleKeyInfo obj) { return obj._keyChar == _keyChar && obj._key == _key && obj._mods == _mods; } public static bool operator ==(ConsoleKeyInfo a, ConsoleKeyInfo b) { return a.Equals(b); } public static bool operator !=(ConsoleKeyInfo a, ConsoleKeyInfo b) { return !(a == b); } public override int GetHashCode() { return (int)_keyChar | (int) _mods; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: ConsoleKeyInfo ** ** ** Purpose: This value type represents a single key press, with modifier keys ** like Alt, Control, and Shift. ** ** =============================================================================*/ namespace System { [Serializable] public struct ConsoleKeyInfo { private char _keyChar; private ConsoleKey _key; private ConsoleModifiers _mods; public ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool control) { // Limit ConsoleKey values to 0 to 255, but don't check whether the // key is a valid value in our ConsoleKey enum. There are a few // values in that enum that we didn't define, and reserved keys // that might start showing up on keyboards in a few years. if (((int)key) < 0 || ((int)key) > 255) throw new ArgumentOutOfRangeException("key", Environment.GetResourceString("ArgumentOutOfRange_ConsoleKey")); _keyChar = keyChar; _key = key; _mods = 0; if (shift) _mods |= ConsoleModifiers.Shift; if (alt) _mods |= ConsoleModifiers.Alt; if (control) _mods |= ConsoleModifiers.Control; } public char KeyChar { get { return _keyChar; } } public ConsoleKey Key { get { return _key; } } public ConsoleModifiers Modifiers { get { return _mods; } } public override bool Equals(Object value) { if (value is ConsoleKeyInfo) return Equals((ConsoleKeyInfo)value); else return false; } public bool Equals(ConsoleKeyInfo obj) { return obj._keyChar == _keyChar && obj._key == _key && obj._mods == _mods; } public static bool operator ==(ConsoleKeyInfo a, ConsoleKeyInfo b) { return a.Equals(b); } public static bool operator !=(ConsoleKeyInfo a, ConsoleKeyInfo b) { return !(a == b); } public override int GetHashCode() { return (int)_keyChar | (int) _mods; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Dynamic.cs
- ListItem.cs
- EdmTypeAttribute.cs
- EventHandlers.cs
- WebPartConnectionsCancelEventArgs.cs
- DataKey.cs
- SelectionListDesigner.cs
- DesignerCommandAdapter.cs
- BlockUIContainer.cs
- DataGridSortingEventArgs.cs
- ConnectivityStatus.cs
- ContentPlaceHolderDesigner.cs
- SpnEndpointIdentityExtension.cs
- TextTreeFixupNode.cs
- safex509handles.cs
- RequestCachePolicy.cs
- WebPartHelpVerb.cs
- UnsafeNativeMethodsMilCoreApi.cs
- CompositionTarget.cs
- TriggerAction.cs
- PerspectiveCamera.cs
- IntSecurity.cs
- SqlMethods.cs
- documentation.cs
- InvalidCommandTreeException.cs
- DbConnectionPoolCounters.cs
- RegularExpressionValidator.cs
- ToolTipService.cs
- ProtocolsConfigurationHandler.cs
- HttpHandlerAction.cs
- AuthenticationException.cs
- SortExpressionBuilder.cs
- XamlStream.cs
- XmlILAnnotation.cs
- BindingNavigator.cs
- SafeViewOfFileHandle.cs
- ContentValidator.cs
- WebPartExportVerb.cs
- HtmlWindowCollection.cs
- SpecialTypeDataContract.cs
- FontInfo.cs
- InputDevice.cs
- DispatcherHookEventArgs.cs
- DiagnosticsElement.cs
- WebResponse.cs
- CssStyleCollection.cs
- SRef.cs
- CommandHelpers.cs
- ConfigurationLocation.cs
- NgenServicingAttributes.cs
- AndAlso.cs
- BitmapImage.cs
- AlignmentYValidation.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- Mappings.cs
- WebPartEditorCancelVerb.cs
- ServiceContractViewControl.cs
- ViewManagerAttribute.cs
- DataGridAutoFormat.cs
- CodeSpit.cs
- DecoderReplacementFallback.cs
- AVElementHelper.cs
- OracleException.cs
- GridViewCancelEditEventArgs.cs
- ConfigXmlText.cs
- XPathDocumentIterator.cs
- CacheAxisQuery.cs
- XomlCompilerParameters.cs
- sitestring.cs
- CollectionContainer.cs
- BinaryObjectWriter.cs
- AsyncSerializedWorker.cs
- SerializationAttributes.cs
- ManagementOperationWatcher.cs
- ObjectReferenceStack.cs
- XmlBinaryReaderSession.cs
- ListView.cs
- RawUIStateInputReport.cs
- DbBuffer.cs
- ResourceDescriptionAttribute.cs
- SurrogateSelector.cs
- OdbcConnectionPoolProviderInfo.cs
- CursorConverter.cs
- SqlClientMetaDataCollectionNames.cs
- UnmanagedMemoryStream.cs
- Int16Converter.cs
- SchemaNames.cs
- KerberosSecurityTokenProvider.cs
- WmfPlaceableFileHeader.cs
- TextServicesDisplayAttributePropertyRanges.cs
- PropertyEmitter.cs
- Int32EqualityComparer.cs
- ExpressionParser.cs
- AmbientProperties.cs
- SoapSchemaMember.cs
- DbDataSourceEnumerator.cs
- ReflectionPermission.cs
- _HeaderInfo.cs
- X509WindowsSecurityToken.cs
- ScaleTransform.cs