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
- WindowsSysHeader.cs
- DescendantQuery.cs
- ApplicationInfo.cs
- ToolstripProfessionalRenderer.cs
- WindowsProgressbar.cs
- WebPartManagerInternals.cs
- EpmSourceTree.cs
- Base64Encoder.cs
- CodeTypeParameterCollection.cs
- QueueAccessMode.cs
- CrossAppDomainChannel.cs
- ToolBarTray.cs
- SoapHeader.cs
- MdiWindowListStrip.cs
- ItemsChangedEventArgs.cs
- SQLBytes.cs
- ScriptResourceAttribute.cs
- XmlSchemaDatatype.cs
- ServerIdentity.cs
- DynamicILGenerator.cs
- PropertyEmitterBase.cs
- Separator.cs
- PathData.cs
- ProxyGenerator.cs
- RegexMatchCollection.cs
- Clipboard.cs
- MultiBinding.cs
- DataServiceHost.cs
- DynamicArgumentDesigner.xaml.cs
- ErrorRuntimeConfig.cs
- SchemaComplexType.cs
- InputBinder.cs
- CodeDelegateInvokeExpression.cs
- PassportPrincipal.cs
- ConfigurationManagerHelperFactory.cs
- AuthenticationConfig.cs
- XmlFormatWriterGenerator.cs
- AttachedAnnotation.cs
- SafeWaitHandle.cs
- IntSecurity.cs
- _Events.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- SourceItem.cs
- ResourcePart.cs
- CodeTypeReferenceExpression.cs
- WebBodyFormatMessageProperty.cs
- DataGridViewRowEventArgs.cs
- MILUtilities.cs
- SolidBrush.cs
- ErrorRuntimeConfig.cs
- FlowDocumentFormatter.cs
- HorizontalAlignConverter.cs
- CreateUserWizard.cs
- GridLength.cs
- Predicate.cs
- CompModSwitches.cs
- DownloadProgressEventArgs.cs
- TextSchema.cs
- SerialErrors.cs
- ClientSideQueueItem.cs
- PersistChildrenAttribute.cs
- Triplet.cs
- GcHandle.cs
- UIServiceHelper.cs
- SeekableMessageNavigator.cs
- BitmapImage.cs
- ToolStripManager.cs
- TablePatternIdentifiers.cs
- OLEDB_Util.cs
- ZipIOLocalFileBlock.cs
- ComplexLine.cs
- XmlException.cs
- SoapFormatterSinks.cs
- ExtendedProtectionPolicyTypeConverter.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- ForEachAction.cs
- CharConverter.cs
- BoundField.cs
- SolidBrush.cs
- _SpnDictionary.cs
- GeneralTransform2DTo3D.cs
- ConnectionOrientedTransportBindingElement.cs
- odbcmetadatafactory.cs
- Task.cs
- PagerSettings.cs
- DataGridLinkButton.cs
- RectAnimation.cs
- ServerValidateEventArgs.cs
- WebServiceClientProxyGenerator.cs
- HtmlGenericControl.cs
- AxImporter.cs
- TextTreeUndo.cs
- BuildProviderCollection.cs
- TextEffect.cs
- PageSetupDialog.cs
- Journaling.cs
- SqlError.cs
- AgileSafeNativeMemoryHandle.cs
- GenericWebPart.cs
- SQLBoolean.cs