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
- InvalidAsynchronousStateException.cs
- FormViewPagerRow.cs
- DetailsViewPageEventArgs.cs
- ConditionCollection.cs
- StrongTypingException.cs
- SHA512Cng.cs
- CoTaskMemUnicodeSafeHandle.cs
- TreeIterator.cs
- PanelStyle.cs
- QueryableDataSourceView.cs
- SQLChars.cs
- DesignerTransactionCloseEvent.cs
- HitTestParameters.cs
- SpellerError.cs
- StylusCaptureWithinProperty.cs
- OrderedDictionary.cs
- IntranetCredentialPolicy.cs
- IIS7WorkerRequest.cs
- DispatcherOperation.cs
- HuffCodec.cs
- ParseNumbers.cs
- Section.cs
- ArgumentOutOfRangeException.cs
- AutoGeneratedFieldProperties.cs
- ValueCollectionParameterReader.cs
- GeometryCombineModeValidation.cs
- ZipIOModeEnforcingStream.cs
- HttpVersion.cs
- EraserBehavior.cs
- InputScopeAttribute.cs
- GridLength.cs
- indexingfiltermarshaler.cs
- ScrollChrome.cs
- PeerEndPoint.cs
- lengthconverter.cs
- CalendarData.cs
- LineServicesCallbacks.cs
- ChangeConflicts.cs
- BamlBinaryReader.cs
- RouteCollection.cs
- RowCache.cs
- StylusPlugInCollection.cs
- Block.cs
- DateTimeUtil.cs
- NetPipeSectionData.cs
- HtmlInputImage.cs
- HttpInputStream.cs
- CommandID.cs
- SpeakInfo.cs
- AspCompat.cs
- Lease.cs
- MLangCodePageEncoding.cs
- MemoryMappedViewAccessor.cs
- EntityDataSourceView.cs
- PointCollection.cs
- ViewUtilities.cs
- CharacterMetricsDictionary.cs
- DependencyObject.cs
- IProvider.cs
- LineSegment.cs
- CollectionBuilder.cs
- COM2ExtendedBrowsingHandler.cs
- ToolStripSeparatorRenderEventArgs.cs
- RtfToken.cs
- _ListenerResponseStream.cs
- TableLayoutStyle.cs
- SwitchAttribute.cs
- Guid.cs
- WebPartChrome.cs
- CacheEntry.cs
- UniqueEventHelper.cs
- DatePicker.cs
- PositiveTimeSpanValidator.cs
- Compilation.cs
- BinHexDecoder.cs
- ProfileElement.cs
- Column.cs
- ProxyBuilder.cs
- GroupedContextMenuStrip.cs
- ClientEventManager.cs
- StylusTip.cs
- GPRECTF.cs
- xmlfixedPageInfo.cs
- WindowsListViewGroupHelper.cs
- ToolStripContentPanel.cs
- CodeAttributeDeclaration.cs
- LocalizedNameDescriptionPair.cs
- UserControlFileEditor.cs
- DataGridViewIntLinkedList.cs
- WindowsEditBoxRange.cs
- WindowsTokenRoleProvider.cs
- DiscoveryClientProtocol.cs
- ModelItemCollection.cs
- UniqueConstraint.cs
- AuthenticationModuleElementCollection.cs
- TimerElapsedEvenArgs.cs
- SharedPersonalizationStateInfo.cs
- ExpressionBinding.cs
- WorkflowQueue.cs
- DataGridViewCellMouseEventArgs.cs