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
- SystemTcpStatistics.cs
- ActiveXSite.cs
- CodeDomDesignerLoader.cs
- WhiteSpaceTrimStringConverter.cs
- PageWrapper.cs
- SqlServices.cs
- Suspend.cs
- MimeFormatter.cs
- Timeline.cs
- XamlParser.cs
- GeneralTransform3DTo2DTo3D.cs
- KeyNotFoundException.cs
- ApplicationFileCodeDomTreeGenerator.cs
- SQLInt32Storage.cs
- SmiConnection.cs
- DataGridPagerStyle.cs
- InstanceDataCollection.cs
- CustomValidator.cs
- Region.cs
- IndexedWhereQueryOperator.cs
- ViewRendering.cs
- HotSpotCollection.cs
- WsdlBuildProvider.cs
- EntityCommandCompilationException.cs
- WebBrowsableAttribute.cs
- XamlSerializerUtil.cs
- DateTimeFormat.cs
- HierarchicalDataSourceControl.cs
- WindowManager.cs
- InstanceNameConverter.cs
- SimpleTextLine.cs
- ReaderWriterLockWrapper.cs
- AssemblyResourceLoader.cs
- XmlSchemaSimpleContentRestriction.cs
- HttpHandlersSection.cs
- ClientTargetSection.cs
- SessionStateItemCollection.cs
- ResourceDisplayNameAttribute.cs
- ScrollEventArgs.cs
- FullTextState.cs
- OneOf.cs
- ArgumentOutOfRangeException.cs
- SRDisplayNameAttribute.cs
- GradientSpreadMethodValidation.cs
- NavigationPropertyEmitter.cs
- TempFiles.cs
- PropertyChangedEventManager.cs
- Assert.cs
- Label.cs
- TargetInvocationException.cs
- FixedHyperLink.cs
- EasingFunctionBase.cs
- ExpressionPrefixAttribute.cs
- ListSourceHelper.cs
- RenderCapability.cs
- StreamWithDictionary.cs
- ScrollContentPresenter.cs
- TextEffectCollection.cs
- relpropertyhelper.cs
- Activation.cs
- GuidelineCollection.cs
- IncrementalReadDecoders.cs
- ColorPalette.cs
- TextOnlyOutput.cs
- CursorEditor.cs
- DefaultTypeArgumentAttribute.cs
- ScopelessEnumAttribute.cs
- FixedSOMLineRanges.cs
- ServiceObjectContainer.cs
- CfgParser.cs
- CaseExpr.cs
- HtmlToClrEventProxy.cs
- AnnotationService.cs
- XmlObjectSerializerWriteContextComplex.cs
- mactripleDES.cs
- PointLightBase.cs
- SafeProcessHandle.cs
- SqlDeflator.cs
- HtmlTable.cs
- ContractAdapter.cs
- ConfigurationPropertyAttribute.cs
- Column.cs
- LambdaCompiler.Generated.cs
- _ConnectOverlappedAsyncResult.cs
- WebPartDisplayModeCollection.cs
- InkCanvas.cs
- SecurityResources.cs
- BookmarkEventArgs.cs
- DataGridViewIntLinkedList.cs
- SourceFileBuildProvider.cs
- MinimizableAttributeTypeConverter.cs
- HierarchicalDataTemplate.cs
- NestPullup.cs
- SubMenuStyleCollection.cs
- ObjectAnimationBase.cs
- NetStream.cs
- WebReferencesBuildProvider.cs
- Input.cs
- DataViewSettingCollection.cs
- BypassElement.cs