Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- NGCSerializerAsync.cs
- SystemWebSectionGroup.cs
- HttpChannelBindingToken.cs
- EntitySqlQueryState.cs
- DataPointer.cs
- HtmlPanelAdapter.cs
- ProfileSection.cs
- DataListItemEventArgs.cs
- LineServicesCallbacks.cs
- Validator.cs
- ObjectDataSourceSelectingEventArgs.cs
- CodeTypeDeclarationCollection.cs
- TextTreeUndoUnit.cs
- EventLogPropertySelector.cs
- AttachmentCollection.cs
- Globals.cs
- DependencyPropertyDescriptor.cs
- coordinatorfactory.cs
- _AutoWebProxyScriptEngine.cs
- RotateTransform3D.cs
- ProgressBar.cs
- DesignerExtenders.cs
- DataGridViewTopRowAccessibleObject.cs
- Double.cs
- ObfuscationAttribute.cs
- _ContextAwareResult.cs
- ClientTargetSection.cs
- ControlPaint.cs
- XPathQilFactory.cs
- IpcChannel.cs
- TemplateControlBuildProvider.cs
- SecurityKeyIdentifierClause.cs
- TrackingValidationObjectDictionary.cs
- _NativeSSPI.cs
- SoapFault.cs
- RegexGroup.cs
- UDPClient.cs
- SafeRegistryHandle.cs
- ProfileInfo.cs
- StylusCaptureWithinProperty.cs
- ResourcePart.cs
- x509store.cs
- SchemaImporterExtensionsSection.cs
- AnimationStorage.cs
- LoginStatusDesigner.cs
- SpecialTypeDataContract.cs
- WmiInstallComponent.cs
- ContractListAdapter.cs
- XPathDocumentIterator.cs
- EFColumnProvider.cs
- BooleanSwitch.cs
- DbParameterHelper.cs
- SerializationEventsCache.cs
- DateTime.cs
- FontStretch.cs
- DefaultExpression.cs
- WorkerRequest.cs
- ZipFileInfoCollection.cs
- Color.cs
- SplineQuaternionKeyFrame.cs
- ScriptControlDescriptor.cs
- ClientProxyGenerator.cs
- SerializationSectionGroup.cs
- KeyPullup.cs
- DataGridRowsPresenter.cs
- OrderedDictionaryStateHelper.cs
- InputReportEventArgs.cs
- CommonGetThemePartSize.cs
- ObjectDataSourceMethodEventArgs.cs
- ProxyWebPartConnectionCollection.cs
- UserControlCodeDomTreeGenerator.cs
- SqlBulkCopy.cs
- IsolatedStorageException.cs
- WebPartManager.cs
- MimeFormImporter.cs
- HttpException.cs
- InternalCache.cs
- TraceContextEventArgs.cs
- Imaging.cs
- SystemParameters.cs
- IntMinMaxAggregationOperator.cs
- InvokeBinder.cs
- ArraySubsetEnumerator.cs
- AffineTransform3D.cs
- isolationinterop.cs
- PolyLineSegmentFigureLogic.cs
- Method.cs
- CustomAttribute.cs
- MultiPropertyDescriptorGridEntry.cs
- Point.cs
- DataGridViewCellStyleConverter.cs
- InvalidEnumArgumentException.cs
- ValidatedMobileControlConverter.cs
- ToolStripContainer.cs
- Asn1IntegerConverter.cs
- XmlAttributeHolder.cs
- RightsManagementInformation.cs
- LicenseProviderAttribute.cs
- EntityCollectionChangedParams.cs
- RangeBaseAutomationPeer.cs