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
- PeerApplication.cs
- ImageAttributes.cs
- GACMembershipCondition.cs
- ArithmeticException.cs
- ClientSession.cs
- Symbol.cs
- InfoCardServiceInstallComponent.cs
- DownloadProgressEventArgs.cs
- SafeRegistryKey.cs
- InstanceDataCollection.cs
- ProjectionQueryOptionExpression.cs
- SQLBytesStorage.cs
- CommonObjectSecurity.cs
- PrinterUnitConvert.cs
- RelationshipEndMember.cs
- FtpWebRequest.cs
- DataTableReaderListener.cs
- Ref.cs
- ObjectStorage.cs
- XmlILConstructAnalyzer.cs
- SqlDataAdapter.cs
- WebDisplayNameAttribute.cs
- Vector3DCollection.cs
- TempFiles.cs
- HandlerFactoryCache.cs
- PeerTransportListenAddressConverter.cs
- FunctionParameter.cs
- ConnectionInterfaceCollection.cs
- BitmapMetadataEnumerator.cs
- DataContractAttribute.cs
- ObjectCache.cs
- IntranetCredentialPolicy.cs
- CompilerGlobalScopeAttribute.cs
- ModuleElement.cs
- UdpChannelListener.cs
- TdsParserSafeHandles.cs
- cookie.cs
- CryptoConfig.cs
- PropertyMetadata.cs
- XPathNodeInfoAtom.cs
- IsolatedStoragePermission.cs
- LogReservationCollection.cs
- Ticks.cs
- Internal.cs
- QilInvokeEarlyBound.cs
- Debugger.cs
- NamedPipeProcessProtocolHandler.cs
- SqlExpander.cs
- DelegatedStream.cs
- DataSourceCache.cs
- InvokeWebService.cs
- XPathExpr.cs
- ObjectAssociationEndMapping.cs
- PropagationProtocolsTracing.cs
- ValidateNames.cs
- PropertyChangeTracker.cs
- WorkflowOwnerAsyncResult.cs
- EdmFunction.cs
- FontCollection.cs
- DbDeleteCommandTree.cs
- Utils.cs
- ExpressionLink.cs
- TraceContext.cs
- MailMessageEventArgs.cs
- CachedFontFamily.cs
- XslAst.cs
- WindowsRichEdit.cs
- SoapIncludeAttribute.cs
- GeometryModel3D.cs
- DateTimeOffsetAdapter.cs
- TimeSpanStorage.cs
- RegisteredHiddenField.cs
- BufferedWebEventProvider.cs
- DateTimeSerializationSection.cs
- HtmlTextViewAdapter.cs
- DocumentPageView.cs
- XmlILStorageConverter.cs
- TCEAdapterGenerator.cs
- ArglessEventHandlerProxy.cs
- DriveNotFoundException.cs
- BuildResultCache.cs
- FlowDocumentFormatter.cs
- ParagraphVisual.cs
- Span.cs
- ObjectDataSourceSelectingEventArgs.cs
- Material.cs
- SmiMetaData.cs
- MatrixTransform.cs
- SqlNode.cs
- DataControlReference.cs
- Maps.cs
- XmlSchemaAnnotation.cs
- InputLanguageProfileNotifySink.cs
- StylesEditorDialog.cs
- ReflectionHelper.cs
- AutoGeneratedField.cs
- ListenerElementsCollection.cs
- TextServicesDisplayAttributePropertyRanges.cs
- CompositeFontFamily.cs
- BaseAutoFormat.cs