Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Printing / TriState.cs / 1305376 / 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. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ForwardPositionQuery.cs
- Geometry.cs
- AnimationLayer.cs
- ProfessionalColorTable.cs
- CustomErrorsSection.cs
- CompareInfo.cs
- ToolStrip.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- GridViewDeleteEventArgs.cs
- Authorization.cs
- CodeSnippetCompileUnit.cs
- XhtmlBasicCommandAdapter.cs
- RtfToXamlLexer.cs
- MemberAssignment.cs
- VersionedStream.cs
- Part.cs
- ColorIndependentAnimationStorage.cs
- SecurityDescriptor.cs
- LambdaCompiler.Address.cs
- MSAAEventDispatcher.cs
- ISessionStateStore.cs
- DataRecordInfo.cs
- JavascriptCallbackMessageInspector.cs
- XmlSchemaException.cs
- ControlCachePolicy.cs
- IndentedWriter.cs
- XPathScanner.cs
- CachedFontFamily.cs
- UInt16Storage.cs
- RectangleConverter.cs
- DbModificationClause.cs
- DbConnectionInternal.cs
- XmlDocumentFragment.cs
- RadioButtonList.cs
- ResponseBodyWriter.cs
- EventPrivateKey.cs
- LocatorBase.cs
- NotificationContext.cs
- HTMLTextWriter.cs
- XmlDataSource.cs
- Component.cs
- Marshal.cs
- UserControlParser.cs
- OutputCacheProfile.cs
- TraceData.cs
- JoinElimination.cs
- EntityTransaction.cs
- MediaScriptCommandRoutedEventArgs.cs
- Internal.cs
- WebPartConnectionsCancelVerb.cs
- StringExpressionSet.cs
- TextRangeEditTables.cs
- RequestContext.cs
- UriParserTemplates.cs
- ActiveDesignSurfaceEvent.cs
- RestHandlerFactory.cs
- RouteData.cs
- GridItemCollection.cs
- DataSourceCacheDurationConverter.cs
- UshortList2.cs
- StringUtil.cs
- IndexedGlyphRun.cs
- ExceptionValidationRule.cs
- RegexFCD.cs
- WebPartVerbCollection.cs
- ParseChildrenAsPropertiesAttribute.cs
- Padding.cs
- GridViewDeleteEventArgs.cs
- UpDownEvent.cs
- WorkflowRuntimeService.cs
- ListBox.cs
- TerminatingOperationBehavior.cs
- localization.cs
- CrossSiteScriptingValidation.cs
- QueryResponse.cs
- ScriptMethodAttribute.cs
- DbUpdateCommandTree.cs
- NotSupportedException.cs
- ManagementEventWatcher.cs
- FilterQuery.cs
- DropShadowBitmapEffect.cs
- PropertyGridCommands.cs
- FileVersion.cs
- Semaphore.cs
- BindingMemberInfo.cs
- Size.cs
- DynamicMetaObjectBinder.cs
- QueryResults.cs
- CompiledQueryCacheEntry.cs
- DesignerForm.cs
- XmlILCommand.cs
- NativeMethods.cs
- Set.cs
- SafeTimerHandle.cs
- InputScopeConverter.cs
- OutputCacheSettingsSection.cs
- DurableOperationAttribute.cs
- TypeTypeConverter.cs
- CustomValidator.cs
- EditingMode.cs