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
- LicFileLicenseProvider.cs
- Metadata.cs
- ListItemConverter.cs
- DbConnectionPoolCounters.cs
- PrePostDescendentsWalker.cs
- ToolStripSplitButton.cs
- CodeDomLocalizationProvider.cs
- PlatformNotSupportedException.cs
- UiaCoreApi.cs
- NativeActivityTransactionContext.cs
- CryptoHelper.cs
- DirectoryInfo.cs
- ErrorWrapper.cs
- UriSection.cs
- TableCell.cs
- FontEmbeddingManager.cs
- SByteConverter.cs
- OutputCacheSettingsSection.cs
- BitmapEditor.cs
- OletxResourceManager.cs
- QueryOperationResponseOfT.cs
- XmlSchemaAll.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- cookie.cs
- PopOutPanel.cs
- BevelBitmapEffect.cs
- DataList.cs
- SqlDataReaderSmi.cs
- _NestedMultipleAsyncResult.cs
- TemplatedMailWebEventProvider.cs
- NamedPipeChannelListener.cs
- PersonalizationProviderHelper.cs
- DataKeyCollection.cs
- Walker.cs
- FamilyTypeface.cs
- HandlerBase.cs
- ModuleConfigurationInfo.cs
- Select.cs
- HtmlTableRowCollection.cs
- StrongNamePublicKeyBlob.cs
- XmlCharacterData.cs
- ToolStrip.cs
- GeneralTransform2DTo3D.cs
- GlyphRunDrawing.cs
- CompoundFileStorageReference.cs
- IntellisenseTextBox.cs
- SqlBulkCopy.cs
- DrawingVisualDrawingContext.cs
- NativeMethodsOther.cs
- DrawingBrush.cs
- IPEndPoint.cs
- ContainerUIElement3D.cs
- ResolvedKeyFrameEntry.cs
- DateTimeOffset.cs
- DBSqlParserColumn.cs
- AsyncCompletedEventArgs.cs
- WorkflowRuntimeServiceElementCollection.cs
- DbMetaDataColumnNames.cs
- XPathArrayIterator.cs
- PublisherIdentityPermission.cs
- LinqToSqlWrapper.cs
- CodeDomConfigurationHandler.cs
- TreeSet.cs
- ServiceEndpointAssociationProvider.cs
- TextElementCollectionHelper.cs
- CodeAttributeDeclarationCollection.cs
- EUCJPEncoding.cs
- DbConnectionPoolOptions.cs
- NullReferenceException.cs
- PropertiesTab.cs
- IdnMapping.cs
- GroupBoxAutomationPeer.cs
- Stroke2.cs
- Tablet.cs
- HwndStylusInputProvider.cs
- PartitionerQueryOperator.cs
- sqlinternaltransaction.cs
- SchemaTypeEmitter.cs
- LinearKeyFrames.cs
- SQLInt64Storage.cs
- DynamicValidator.cs
- mediaeventshelper.cs
- WebEvents.cs
- RoleGroupCollection.cs
- HwndSourceParameters.cs
- Stroke2.cs
- PageAsyncTask.cs
- TextServicesCompartment.cs
- OleDbTransaction.cs
- SecurityPermission.cs
- MarkedHighlightComponent.cs
- GACIdentityPermission.cs
- HtmlContainerControl.cs
- ISCIIEncoding.cs
- TypeBrowserDialog.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- CorrelationResolver.cs
- TextProperties.cs
- XmlAttributeCache.cs
- CompressEmulationStream.cs