Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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. // Copyright (c) Microsoft Corporation. All rights reserved./// 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
- sqlmetadatafactory.cs
- Axis.cs
- CodeLabeledStatement.cs
- GenericAuthenticationEventArgs.cs
- IPPacketInformation.cs
- DataBoundControlAdapter.cs
- AudioStateChangedEventArgs.cs
- EventRecord.cs
- SRGSCompiler.cs
- Matrix3D.cs
- EnvironmentPermission.cs
- TraceLevelHelper.cs
- ComplusTypeValidator.cs
- MediaSystem.cs
- ToolStripPanelSelectionGlyph.cs
- WebEventTraceProvider.cs
- MetadataCacheItem.cs
- OdbcError.cs
- DataGridLinkButton.cs
- Block.cs
- PersonalizationEntry.cs
- FixedDocumentSequencePaginator.cs
- StringArrayConverter.cs
- PriorityQueue.cs
- XmlCountingReader.cs
- ToolStripEditorManager.cs
- Inline.cs
- TimeSpanFormat.cs
- CssStyleCollection.cs
- DatePicker.cs
- ListenerConnectionModeReader.cs
- NullExtension.cs
- OleDbDataAdapter.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- HandleRef.cs
- util.cs
- SingletonInstanceContextProvider.cs
- ExpressionTextBox.xaml.cs
- SettingsSavedEventArgs.cs
- SqlFacetAttribute.cs
- TypeSemantics.cs
- Baml2006Reader.cs
- VectorCollectionConverter.cs
- XmlWrappingReader.cs
- StringPropertyBuilder.cs
- BamlCollectionHolder.cs
- ExpressionBinding.cs
- DbConnectionFactory.cs
- Marshal.cs
- FillErrorEventArgs.cs
- QueuedDeliveryRequirementsMode.cs
- LinqExpressionNormalizer.cs
- X509Certificate.cs
- UrlRoutingModule.cs
- BulletDecorator.cs
- XmlDictionaryReaderQuotas.cs
- HttpHandlerAction.cs
- TemplateLookupAction.cs
- OrderedEnumerableRowCollection.cs
- _SSPISessionCache.cs
- BlockUIContainer.cs
- SoapObjectWriter.cs
- LocalizedNameDescriptionPair.cs
- XPathNodeInfoAtom.cs
- ObjectAssociationEndMapping.cs
- PartitionedStreamMerger.cs
- KeyValueConfigurationCollection.cs
- DesignerVerb.cs
- StyleCollectionEditor.cs
- ObjectResult.cs
- Logging.cs
- UnmanagedBitmapWrapper.cs
- CodeIdentifier.cs
- TextFormattingConverter.cs
- VisualStyleInformation.cs
- TargetControlTypeCache.cs
- ColorInterpolationModeValidation.cs
- WindowsFormsHelpers.cs
- RuntimeHandles.cs
- infer.cs
- EventSetter.cs
- ColumnBinding.cs
- AmbientLight.cs
- InputProcessorProfilesLoader.cs
- CollectionChangedEventManager.cs
- KoreanCalendar.cs
- SelectionEditingBehavior.cs
- Random.cs
- _ListenerRequestStream.cs
- WeakReadOnlyCollection.cs
- WebBrowserPermission.cs
- TraceEventCache.cs
- ParsedAttributeCollection.cs
- SamlAuthenticationClaimResource.cs
- GPPOINTF.cs
- TextBoxRenderer.cs
- XmlSerializerVersionAttribute.cs
- InfoCardTraceRecord.cs
- LinearKeyFrames.cs
- Fonts.cs