Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Printing / TriState.cs / 1 / TriState.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Printing { using System.ComponentModel; using System.Diagnostics; using System; [Serializable] internal struct TriState { private byte value; // 0 is "default", not false public static readonly TriState Default = new TriState(0); public static readonly TriState False = new TriState(1); public static readonly TriState True = new TriState(2); private TriState(byte value) { this.value = value; } public bool IsDefault { get { return this == Default;} } public bool IsFalse { get { return this == False;} } public bool IsNotDefault { get { return this != Default;} } public bool IsTrue { get { return this == True;} } public static bool operator ==(TriState left, TriState right) { return left.value == right.value; } public static bool operator !=(TriState left, TriState right) { return !(left == right); } public override bool Equals( object o ) { TriState state = (TriState)o; return this.value == state.value; } public override int GetHashCode() { return value; } public static implicit operator TriState(bool value) { return(value) ? True : False; } public static explicit operator bool(TriState value) { if (value.IsDefault) throw new InvalidCastException(SR.GetString(SR.TriStateCompareError)); else return(value == TriState.True); } ////// /// /// public override string ToString() { if (this == Default) return "Default"; else if (this == False) return "False"; else return "True"; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Provides some interesting information about the TriState in /// String form. /// ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Printing { using System.ComponentModel; using System.Diagnostics; using System; [Serializable] internal struct TriState { private byte value; // 0 is "default", not false public static readonly TriState Default = new TriState(0); public static readonly TriState False = new TriState(1); public static readonly TriState True = new TriState(2); private TriState(byte value) { this.value = value; } public bool IsDefault { get { return this == Default;} } public bool IsFalse { get { return this == False;} } public bool IsNotDefault { get { return this != Default;} } public bool IsTrue { get { return this == True;} } public static bool operator ==(TriState left, TriState right) { return left.value == right.value; } public static bool operator !=(TriState left, TriState right) { return !(left == right); } public override bool Equals( object o ) { TriState state = (TriState)o; return this.value == state.value; } public override int GetHashCode() { return value; } public static implicit operator TriState(bool value) { return(value) ? True : False; } public static explicit operator bool(TriState value) { if (value.IsDefault) throw new InvalidCastException(SR.GetString(SR.TriStateCompareError)); else return(value == TriState.True); } ////// /// /// public override string ToString() { if (this == Default) return "Default"; else if (this == False) return "False"; else return "True"; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Provides some interesting information about the TriState in /// String form. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExtendedTransformFactory.cs
- WsiProfilesElementCollection.cs
- ReachBasicContext.cs
- ProfileParameter.cs
- ColumnCollection.cs
- ListBoxItemAutomationPeer.cs
- DataReaderContainer.cs
- odbcmetadatacollectionnames.cs
- SchemaMapping.cs
- DateTimeParse.cs
- XDeferredAxisSource.cs
- TdsParserSessionPool.cs
- SimpleMailWebEventProvider.cs
- ZipIOLocalFileHeader.cs
- XamlPathDataSerializer.cs
- ResourceReferenceKeyNotFoundException.cs
- XmlNode.cs
- BitmapEffectDrawingContextWalker.cs
- WebScriptEndpointElement.cs
- KeyedHashAlgorithm.cs
- NativeWrapper.cs
- ReadOnlyCollectionBuilder.cs
- RequestBringIntoViewEventArgs.cs
- FamilyTypeface.cs
- ProfileGroupSettingsCollection.cs
- Tuple.cs
- HealthMonitoringSectionHelper.cs
- XmlIlVisitor.cs
- QueryStringParameter.cs
- DataListItem.cs
- _CookieModule.cs
- ReliableSessionBindingElement.cs
- EmptyQuery.cs
- UnknownWrapper.cs
- JavaScriptString.cs
- SessionStateContainer.cs
- QuaternionAnimationUsingKeyFrames.cs
- Single.cs
- ModifierKeysValueSerializer.cs
- DataGridViewComboBoxColumn.cs
- Assert.cs
- GeneralTransformCollection.cs
- EndEvent.cs
- BoundColumn.cs
- HtmlInputCheckBox.cs
- MetaModel.cs
- Matrix.cs
- ThreadPool.cs
- COMException.cs
- ProfileEventArgs.cs
- DetailsViewCommandEventArgs.cs
- DebugHandleTracker.cs
- KeyInterop.cs
- WebPartPersonalization.cs
- CompModHelpers.cs
- FormsAuthentication.cs
- MenuScrollingVisibilityConverter.cs
- _DisconnectOverlappedAsyncResult.cs
- ScopedKnownTypes.cs
- MDIControlStrip.cs
- HGlobalSafeHandle.cs
- CodeSnippetTypeMember.cs
- MLangCodePageEncoding.cs
- ExtentCqlBlock.cs
- Compress.cs
- GiveFeedbackEventArgs.cs
- SafeRightsManagementEnvironmentHandle.cs
- SoapExtensionTypeElement.cs
- EncryptedKeyIdentifierClause.cs
- RangeBaseAutomationPeer.cs
- PingOptions.cs
- GenericAuthenticationEventArgs.cs
- ClientType.cs
- RotateTransform3D.cs
- ADMembershipUser.cs
- TreeNodeConverter.cs
- HostProtectionException.cs
- XmlObjectSerializerReadContext.cs
- SQLByteStorage.cs
- MemberInitExpression.cs
- MasterPageBuildProvider.cs
- BindingBase.cs
- ProviderException.cs
- TableRowsCollectionEditor.cs
- XmlSiteMapProvider.cs
- SamlConstants.cs
- PtsPage.cs
- WebBrowserContainer.cs
- Automation.cs
- Operators.cs
- SizeChangedInfo.cs
- AsymmetricAlgorithm.cs
- DateTimeOffset.cs
- FlowDecisionLabelFeature.cs
- ServiceBusyException.cs
- GlyphShapingProperties.cs
- CqlParser.cs
- CertificateManager.cs
- TrustSection.cs
- AtomEntry.cs