Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ComplexObject.cs
- TransactionScopeDesigner.cs
- CorrelationTokenTypeConvertor.cs
- SurrogateEncoder.cs
- DataSourceHelper.cs
- DataGridPageChangedEventArgs.cs
- FactoryId.cs
- WebDisplayNameAttribute.cs
- SymbolMethod.cs
- QueryCacheManager.cs
- ResourceReferenceExpressionConverter.cs
- _FtpControlStream.cs
- GB18030Encoding.cs
- VerbConverter.cs
- FacetChecker.cs
- IisTraceListener.cs
- ActivityStateRecord.cs
- SortedList.cs
- EntityDesignerDataSourceView.cs
- DbProviderConfigurationHandler.cs
- EntityDataSourceView.cs
- EpmSyndicationContentSerializer.cs
- SecurityRuntime.cs
- CodeIndexerExpression.cs
- ToolboxItem.cs
- NotCondition.cs
- RootProfilePropertySettingsCollection.cs
- InternalTypeHelper.cs
- StyleModeStack.cs
- ReflectionPermission.cs
- Constraint.cs
- BinaryNode.cs
- Pair.cs
- XmlSchemaAnnotated.cs
- BrowserCapabilitiesFactory.cs
- AnimatedTypeHelpers.cs
- CommandTreeTypeHelper.cs
- HttpCachePolicyWrapper.cs
- Win32MouseDevice.cs
- SHA384.cs
- HttpApplicationFactory.cs
- BindingWorker.cs
- Pens.cs
- CodeExpressionRuleDeclaration.cs
- DragEventArgs.cs
- SizeAnimation.cs
- MouseEventArgs.cs
- ColumnWidthChangedEvent.cs
- FormatterServicesNoSerializableCheck.cs
- RSAOAEPKeyExchangeFormatter.cs
- OleDbReferenceCollection.cs
- DataDesignUtil.cs
- DataGridViewImageColumn.cs
- EntityKey.cs
- XmlReflectionImporter.cs
- CodeDomLocalizationProvider.cs
- SingleResultAttribute.cs
- TextEncodedRawTextWriter.cs
- xml.cs
- Win32.cs
- WebBrowserPermission.cs
- ViewGenerator.cs
- WebPartEditVerb.cs
- HTMLTextWriter.cs
- ContextQuery.cs
- WindowsSolidBrush.cs
- HyperLink.cs
- SynchronizationContextHelper.cs
- AmbiguousMatchException.cs
- ConnectionStringSettings.cs
- WebPartsPersonalizationAuthorization.cs
- UnhandledExceptionEventArgs.cs
- RunInstallerAttribute.cs
- _HTTPDateParse.cs
- FileSystemEventArgs.cs
- MultipleCopiesCollection.cs
- EmbeddedMailObjectsCollection.cs
- TextBreakpoint.cs
- LinkLabelLinkClickedEvent.cs
- ResourceManagerWrapper.cs
- ToolStripLocationCancelEventArgs.cs
- ColumnMap.cs
- SocketAddress.cs
- DependencyObjectCodeDomSerializer.cs
- QilReference.cs
- KnownBoxes.cs
- MimeTypeAttribute.cs
- XamlSerializerUtil.cs
- ImageAttributes.cs
- OperationAbortedException.cs
- DeferredElementTreeState.cs
- CharacterShapingProperties.cs
- Vertex.cs
- PixelShader.cs
- StdRegProviderWrapper.cs
- CodeTypeDeclarationCollection.cs
- ExpressionList.cs
- _NestedMultipleAsyncResult.cs
- UpdateExpressionVisitor.cs
- PageCodeDomTreeGenerator.cs