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
- OutputScopeManager.cs
- FlagPanel.cs
- UnsafeNativeMethods.cs
- MarshalDirectiveException.cs
- DataSourceControlBuilder.cs
- UnknownBitmapDecoder.cs
- StringUtil.cs
- ResourceDisplayNameAttribute.cs
- sqlnorm.cs
- ForwardPositionQuery.cs
- OdbcConnectionPoolProviderInfo.cs
- DropShadowEffect.cs
- SeparatorAutomationPeer.cs
- TransformValueSerializer.cs
- ActionFrame.cs
- FixedLineResult.cs
- BezierSegment.cs
- XmlReflectionMember.cs
- SoapSchemaImporter.cs
- CompiledScopeCriteria.cs
- WebEvents.cs
- BStrWrapper.cs
- SyndicationDeserializer.cs
- PolicyUnit.cs
- AssemblyAssociatedContentFileAttribute.cs
- DataSourceXmlTextReader.cs
- FrameworkElement.cs
- EventHandlingScope.cs
- Style.cs
- StringReader.cs
- RoleService.cs
- _NTAuthentication.cs
- updateconfighost.cs
- CompilationUnit.cs
- PointF.cs
- TypedReference.cs
- Ray3DHitTestResult.cs
- XmlWellformedWriter.cs
- JsonSerializer.cs
- AttributeInfo.cs
- Axis.cs
- XsdBuilder.cs
- DbgUtil.cs
- SqlDataSource.cs
- XmlAttributeCollection.cs
- RestHandler.cs
- ClickablePoint.cs
- DefaultAsyncDataDispatcher.cs
- BindingElementExtensionElement.cs
- Root.cs
- GradientStopCollection.cs
- StatusStrip.cs
- MexHttpBindingCollectionElement.cs
- PageClientProxyGenerator.cs
- DeviceContext.cs
- MsdtcClusterUtils.cs
- CultureInfoConverter.cs
- ImpersonationContext.cs
- PackWebRequest.cs
- SqlPersistenceProviderFactory.cs
- CodeRegionDirective.cs
- RepeaterItemEventArgs.cs
- HttpModuleCollection.cs
- TrackingQueryElement.cs
- ToolBarTray.cs
- ColumnPropertiesGroup.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- ObjectDataSourceEventArgs.cs
- PerformanceCountersElement.cs
- HMACSHA256.cs
- PieceDirectory.cs
- Emitter.cs
- RectangleHotSpot.cs
- WorkflowApplicationEventArgs.cs
- IntSecurity.cs
- SmtpReplyReaderFactory.cs
- EmptyEnumerator.cs
- EnterpriseServicesHelper.cs
- CatalogZoneDesigner.cs
- DesignOnlyAttribute.cs
- XmlSchemaSubstitutionGroup.cs
- DelegatingConfigHost.cs
- X509CertificateInitiatorServiceCredential.cs
- EntityDataSourceView.cs
- EffectiveValueEntry.cs
- WebControlParameterProxy.cs
- PaperSource.cs
- AssemblyNameProxy.cs
- JsonFormatWriterGenerator.cs
- BaseCAMarshaler.cs
- DetailsViewPagerRow.cs
- ObjectSpanRewriter.cs
- TraceContextRecord.cs
- Item.cs
- SchemaSetCompiler.cs
- XmlDocumentFragment.cs
- DateTimeStorage.cs
- SynthesizerStateChangedEventArgs.cs
- TypeDescriptorFilterService.cs
- MenuEventArgs.cs