Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- SafeFileMappingHandle.cs
- ImageSourceConverter.cs
- BindingExpressionBase.cs
- AffineTransform3D.cs
- ActivityTrace.cs
- InputScopeNameConverter.cs
- GlyphShapingProperties.cs
- Panel.cs
- ListView.cs
- ColumnHeader.cs
- ProtocolsSection.cs
- RequestNavigateEventArgs.cs
- RTLAwareMessageBox.cs
- ChainOfResponsibility.cs
- GZipDecoder.cs
- nulltextcontainer.cs
- ContentPlaceHolder.cs
- ScrollData.cs
- Vector3DAnimation.cs
- PersonalizableTypeEntry.cs
- UnsafeNativeMethods.cs
- WebHttpBehavior.cs
- SocketAddress.cs
- FixedSchema.cs
- DataGridViewHitTestInfo.cs
- DPCustomTypeDescriptor.cs
- NativeWrapper.cs
- CompositionCommandSet.cs
- XMLUtil.cs
- ZipIORawDataFileBlock.cs
- HtmlInputCheckBox.cs
- InvalidPropValue.cs
- CompositeActivityValidator.cs
- DragStartedEventArgs.cs
- HMACSHA384.cs
- TdsParserSafeHandles.cs
- Misc.cs
- UniqueEventHelper.cs
- XmlObjectSerializerReadContextComplex.cs
- HttpInputStream.cs
- __Filters.cs
- LoginCancelEventArgs.cs
- TemplateApplicationHelper.cs
- ValidationSummaryDesigner.cs
- AccessText.cs
- WindowsListViewScroll.cs
- StatusCommandUI.cs
- RowsCopiedEventArgs.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- _HelperAsyncResults.cs
- CollectionChange.cs
- Quaternion.cs
- FixedFindEngine.cs
- PolyQuadraticBezierSegment.cs
- ConnectionStringSettingsCollection.cs
- Image.cs
- GraphicsPath.cs
- DashStyle.cs
- SR.cs
- DecimalStorage.cs
- EntityDataSourceWrapperCollection.cs
- DesignerObjectListAdapter.cs
- ColorConvertedBitmap.cs
- HtmlButton.cs
- MediaElement.cs
- StyleConverter.cs
- BigIntegerStorage.cs
- WebPartAddingEventArgs.cs
- CultureMapper.cs
- BadImageFormatException.cs
- Stylus.cs
- FixedSOMTableCell.cs
- PropertyInformationCollection.cs
- CriticalExceptions.cs
- EditingContext.cs
- Grant.cs
- SystemWebExtensionsSectionGroup.cs
- ConfigXmlText.cs
- InfoCardCryptoHelper.cs
- TraceProvider.cs
- XmlFormatReaderGenerator.cs
- StateBag.cs
- ChangeBlockUndoRecord.cs
- DrawingContext.cs
- LocatorPartList.cs
- AxisAngleRotation3D.cs
- XmlSerializerFormatAttribute.cs
- Utils.cs
- CheckBoxPopupAdapter.cs
- TraceContextEventArgs.cs
- SqlServer2KCompatibilityCheck.cs
- HandlerFactoryWrapper.cs
- DataGridViewCellFormattingEventArgs.cs
- AtlasWeb.Designer.cs
- TextBlock.cs
- SchemaNotation.cs
- Transform.cs
- ContentOperations.cs
- HtmlControl.cs
- NativeWrapper.cs