Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- CacheChildrenQuery.cs
- CollectionBuilder.cs
- ModelPropertyDescriptor.cs
- WebPartCatalogCloseVerb.cs
- ExpressionsCollectionConverter.cs
- FileStream.cs
- RouteValueExpressionBuilder.cs
- ListBoxChrome.cs
- WebReferencesBuildProvider.cs
- RemotingService.cs
- XmlDeclaration.cs
- WrappedReader.cs
- ApplicationServiceHelper.cs
- Emitter.cs
- TypeLoadException.cs
- ConfigurationProperty.cs
- TableLayoutSettingsTypeConverter.cs
- XhtmlBasicLiteralTextAdapter.cs
- PartialCachingControl.cs
- MobileResource.cs
- DataGridRow.cs
- COM2PictureConverter.cs
- TableLayoutCellPaintEventArgs.cs
- StartUpEventArgs.cs
- ProfileManager.cs
- DocumentEventArgs.cs
- XmlSchemaSimpleContentExtension.cs
- UInt16.cs
- FlowchartSizeFeature.cs
- AssociationSet.cs
- Logging.cs
- InstancePersistenceException.cs
- GuidConverter.cs
- MeasureItemEvent.cs
- WindowsScrollBarBits.cs
- BinHexEncoder.cs
- SymDocumentType.cs
- Calendar.cs
- MemberProjectedSlot.cs
- InternalPermissions.cs
- SimpleTextLine.cs
- WeakReadOnlyCollection.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- Keywords.cs
- ColorMap.cs
- PLINQETWProvider.cs
- ActivityStateRecord.cs
- GlyphRunDrawing.cs
- MailAddress.cs
- StringDictionaryWithComparer.cs
- AccessDataSourceWizardForm.cs
- XmlNamespaceManager.cs
- LambdaCompiler.Statements.cs
- WmpBitmapDecoder.cs
- DoubleKeyFrameCollection.cs
- XsltOutput.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- BitmapEffectGroup.cs
- CachedBitmap.cs
- RotationValidation.cs
- OleDbCommand.cs
- MSAAWinEventWrap.cs
- HuffModule.cs
- followingquery.cs
- QueryConverter.cs
- Tile.cs
- Triplet.cs
- SqlCaseSimplifier.cs
- commandenforcer.cs
- Literal.cs
- OlePropertyStructs.cs
- ParserContext.cs
- MsmqInputChannelListenerBase.cs
- CompositeControl.cs
- PersonalizationProviderCollection.cs
- ControlValuePropertyAttribute.cs
- HtmlFormParameterReader.cs
- EventLogPermissionEntryCollection.cs
- XslException.cs
- xmlglyphRunInfo.cs
- TextContainerChangeEventArgs.cs
- TableLayoutStyleCollection.cs
- DataExchangeServiceBinder.cs
- QueryableDataSource.cs
- XamlSerializerUtil.cs
- SafeRightsManagementPubHandle.cs
- TdsParserStateObject.cs
- BaseCollection.cs
- HashRepartitionStream.cs
- TraceInternal.cs
- BroadcastEventHelper.cs
- CompiledQuery.cs
- PositiveTimeSpanValidator.cs
- TempEnvironment.cs
- CollectionContainer.cs
- BaseValidator.cs
- StoreAnnotationsMap.cs
- shaperfactory.cs
- ProbeMatchesMessageCD1.cs
- ContentDisposition.cs