Code:
/ FX-1434 / FX-1434 / 1.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
- CompilerWrapper.cs
- _HeaderInfoTable.cs
- ClientData.cs
- ConditionCollection.cs
- ComponentCodeDomSerializer.cs
- ModifiableIteratorCollection.cs
- DataErrorValidationRule.cs
- BindingCollection.cs
- DataGridViewColumnStateChangedEventArgs.cs
- XNodeValidator.cs
- EmissiveMaterial.cs
- DropTarget.cs
- EntityClassGenerator.cs
- SqlUdtInfo.cs
- CurrentChangingEventManager.cs
- ThaiBuddhistCalendar.cs
- TabItemWrapperAutomationPeer.cs
- OleDbEnumerator.cs
- DataFieldEditor.cs
- SudsCommon.cs
- PermissionRequestEvidence.cs
- PageTheme.cs
- UserControl.cs
- SliderAutomationPeer.cs
- DesignerListAdapter.cs
- TextRangeEditTables.cs
- ToolStripPanel.cs
- DispatchRuntime.cs
- Renderer.cs
- FirstMatchCodeGroup.cs
- XmlUrlResolver.cs
- TextTrailingWordEllipsis.cs
- Double.cs
- MailDefinitionBodyFileNameEditor.cs
- DoubleLinkList.cs
- KeyPressEvent.cs
- AstTree.cs
- UserControl.cs
- Size3D.cs
- ListBox.cs
- BuildManager.cs
- RegistryPermission.cs
- UpdateTranslator.cs
- RelationshipConstraintValidator.cs
- AttributeUsageAttribute.cs
- DocumentSchemaValidator.cs
- SpeakCompletedEventArgs.cs
- MsmqHostedTransportConfiguration.cs
- AppDomainShutdownMonitor.cs
- _AutoWebProxyScriptWrapper.cs
- DataGridBeginningEditEventArgs.cs
- SerializerDescriptor.cs
- OutputCacheProviderCollection.cs
- PageThemeCodeDomTreeGenerator.cs
- InstalledFontCollection.cs
- EventManager.cs
- XmlDeclaration.cs
- InternalCache.cs
- wgx_sdk_version.cs
- ItemsControl.cs
- WSSecureConversationDec2005.cs
- DispatcherProcessingDisabled.cs
- CuspData.cs
- InvalidEnumArgumentException.cs
- PrintEvent.cs
- NativeMethods.cs
- TriState.cs
- FormsAuthenticationModule.cs
- DbConnectionFactory.cs
- TreeViewItem.cs
- TableRowCollection.cs
- InternalControlCollection.cs
- ChildChangedEventArgs.cs
- ComplusEndpointConfigContainer.cs
- IndexerNameAttribute.cs
- WebServiceHostFactory.cs
- SHA1CryptoServiceProvider.cs
- ElementHostAutomationPeer.cs
- iisPickupDirectory.cs
- Set.cs
- PageThemeCodeDomTreeGenerator.cs
- TableRowGroup.cs
- UIElementHelper.cs
- ArrangedElementCollection.cs
- AcceleratedTokenProvider.cs
- DataFormats.cs
- SqlDataSourceFilteringEventArgs.cs
- PermissionListSet.cs
- GlyphInfoList.cs
- ScalarOps.cs
- CalendarDateChangedEventArgs.cs
- TextRunCacheImp.cs
- DbTransaction.cs
- TemplateControl.cs
- ReadWriteSpinLock.cs
- PresentationSource.cs
- WebServiceTypeData.cs
- FactoryMaker.cs
- ManifestBasedResourceGroveler.cs
- OrderedDictionaryStateHelper.cs