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
- SqlDataSourceTableQuery.cs
- ConfigXmlDocument.cs
- safex509handles.cs
- oledbmetadatacollectionnames.cs
- PublisherIdentityPermission.cs
- ThemeDirectoryCompiler.cs
- EntityDataSourceUtil.cs
- HtmlForm.cs
- XDeferredAxisSource.cs
- StreamGeometry.cs
- AdCreatedEventArgs.cs
- WebExceptionStatus.cs
- ConnectorDragDropGlyph.cs
- Int16.cs
- ButtonChrome.cs
- GridItemCollection.cs
- SimpleWebHandlerParser.cs
- PartitionedStream.cs
- AdapterDictionary.cs
- X509Chain.cs
- SecurityKeyType.cs
- Base64Encoder.cs
- ValidationHelper.cs
- PermissionSetTriple.cs
- X509CertificateTrustedIssuerElementCollection.cs
- FlowLayout.cs
- ImageListUtils.cs
- ConfigXmlElement.cs
- AVElementHelper.cs
- PeerPresenceInfo.cs
- NetworkInformationPermission.cs
- RegexGroup.cs
- ObjectDisposedException.cs
- smtppermission.cs
- WindowsPrincipal.cs
- TextServicesPropertyRanges.cs
- BitmapEffectDrawingContextWalker.cs
- JoinCqlBlock.cs
- BinaryNode.cs
- DataControlButton.cs
- FormsAuthenticationEventArgs.cs
- ScalarConstant.cs
- IpcServerChannel.cs
- XPathDocumentBuilder.cs
- PathSegment.cs
- InkCanvasSelection.cs
- PngBitmapEncoder.cs
- SchemaConstraints.cs
- UpdateRecord.cs
- RegistrationServices.cs
- SoapSchemaExporter.cs
- AsyncContentLoadedEventArgs.cs
- StringSource.cs
- AsyncStreamReader.cs
- DocumentOrderComparer.cs
- CompiledXpathExpr.cs
- EntityDataSourceQueryBuilder.cs
- MemberAssignmentAnalysis.cs
- UnSafeCharBuffer.cs
- DataGridViewCellLinkedList.cs
- EntityClientCacheEntry.cs
- SubstitutionList.cs
- IntMinMaxAggregationOperator.cs
- EntityAdapter.cs
- VerificationException.cs
- BooleanSwitch.cs
- BrushValueSerializer.cs
- KeyValueConfigurationElement.cs
- AccessDataSourceView.cs
- SelectedDatesCollection.cs
- ObjectTag.cs
- ProfileSettings.cs
- RoutedEventConverter.cs
- DBPropSet.cs
- HandlerMappingMemo.cs
- XsdCachingReader.cs
- ListBoxItem.cs
- TextCompositionManager.cs
- MemberDomainMap.cs
- StreamAsIStream.cs
- TransformerInfoCollection.cs
- ExpressionServices.cs
- SafeNativeMethods.cs
- Style.cs
- MinMaxParagraphWidth.cs
- MsiStyleLogWriter.cs
- TraceLog.cs
- SystemIPv4InterfaceProperties.cs
- BevelBitmapEffect.cs
- cookiecontainer.cs
- SchemaDeclBase.cs
- PersonalizationAdministration.cs
- SetIndexBinder.cs
- MembershipSection.cs
- ConstraintManager.cs
- sqlstateclientmanager.cs
- ExclusiveTcpTransportManager.cs
- uribuilder.cs
- altserialization.cs
- CustomCredentialPolicy.cs