Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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; } } }
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LinqDataSourceDeleteEventArgs.cs
- HttpServerVarsCollection.cs
- TextFormatterContext.cs
- EventItfInfo.cs
- Vector3DCollectionConverter.cs
- arc.cs
- ListMarkerLine.cs
- XmlHierarchyData.cs
- DependencyPropertyConverter.cs
- Win32KeyboardDevice.cs
- SQLInt16Storage.cs
- FormatSettings.cs
- MatrixIndependentAnimationStorage.cs
- EventHandlingScope.cs
- ListBox.cs
- ToolStripDropDown.cs
- CodeTypeConstructor.cs
- TypeGeneratedEventArgs.cs
- ImmutableObjectAttribute.cs
- SchemaName.cs
- ArcSegment.cs
- GlyphShapingProperties.cs
- ResourcesChangeInfo.cs
- CodeSubDirectoriesCollection.cs
- DetailsViewUpdatedEventArgs.cs
- WorkflowOperationFault.cs
- GlyphRunDrawing.cs
- DesignerTransaction.cs
- WebPartConnectionsConnectVerb.cs
- COM2PropertyDescriptor.cs
- NumericUpDown.cs
- RedistVersionInfo.cs
- FontStretchConverter.cs
- List.cs
- StrokeCollection2.cs
- PictureBoxDesigner.cs
- ACE.cs
- EncodedStreamFactory.cs
- HttpDictionary.cs
- RsaSecurityKey.cs
- FolderBrowserDialog.cs
- ExpressionConverter.cs
- XPathNavigatorReader.cs
- Content.cs
- RowBinding.cs
- DeflateEmulationStream.cs
- ServiceCredentials.cs
- DiscoveryDocumentSearchPattern.cs
- Tokenizer.cs
- TabRenderer.cs
- SqlBooleanizer.cs
- TryLoadRunnableWorkflowCommand.cs
- WebControlsSection.cs
- TextServicesCompartmentContext.cs
- PropertyEntry.cs
- ViewStateModeByIdAttribute.cs
- ValueOfAction.cs
- Ppl.cs
- CharacterMetrics.cs
- DBParameter.cs
- OleAutBinder.cs
- SourceElementsCollection.cs
- DataGridViewButtonColumn.cs
- ScrollProperties.cs
- AutomationElementCollection.cs
- QilFactory.cs
- MD5CryptoServiceProvider.cs
- GenericTypeParameterBuilder.cs
- SymmetricKeyWrap.cs
- InternalConfigEventArgs.cs
- TdsParserHelperClasses.cs
- MailAddress.cs
- ProtocolViolationException.cs
- JournalNavigationScope.cs
- StringToken.cs
- PointUtil.cs
- AnnotationDocumentPaginator.cs
- ProviderUtil.cs
- ComEventsMethod.cs
- ConfigUtil.cs
- CollectionViewGroupInternal.cs
- WindowsFont.cs
- WindowsEditBoxRange.cs
- InvalidDataContractException.cs
- GridView.cs
- GraphicsState.cs
- ThemeableAttribute.cs
- GridViewColumnHeader.cs
- DynamicRenderer.cs
- Int32CollectionConverter.cs
- DataServiceRequestException.cs
- MeshGeometry3D.cs
- ArrayItemReference.cs
- AtomEntry.cs
- GridLengthConverter.cs
- TypeConverterAttribute.cs
- Material.cs
- TextLineBreak.cs
- SqlException.cs
- ListSortDescription.cs