Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Controls / ValidationResult.cs / 1 / ValidationResult.cs
//---------------------------------------------------------------------------- // //// Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // // // // Description: // A ValidationResult is the result of call to ValidationRule.Validate // // See specs at http://avalon/connecteddata/M5%20Specs/Validation.mht // // History: // 5/3/2004 mharper: created. // //--------------------------------------------------------------------------- using System; namespace System.Windows.Controls { ////// A ValidationResult is the result of call to ValidationRule.Validate /// public class ValidationResult { ////// Constructor /// public ValidationResult(bool isValid, object errorContent) { _isValid = isValid; _errorContent = errorContent; } ////// Whether or not the ValidationRule that was checked is valid. /// public bool IsValid { get { return _isValid; } } ////// Additional information regarding the cause of the invalid /// state of the binding that was just checked. /// public object ErrorContent { get { return _errorContent; } } ////// Returns a valid ValidationResult /// public static ValidationResult ValidResult { get { return s_valid; } } ////// Compares the parameters for value equality /// /// left operand /// right operand ///true if the values are equal public static bool operator == (ValidationResult left, ValidationResult right) { return Object.Equals(left, right); } ////// Compares the parameters for value inequality /// /// left operand /// right operand ///true if the values are not equal public static bool operator != (ValidationResult left, ValidationResult right) { return !Object.Equals(left, right); } ////// By-value comparison of ValidationResult /// ////// This method is also used indirectly from the operator overrides. /// /// ValidationResult to be compared against this ValidationRule ///true if obj is ValidationResult and has the same values public override bool Equals(object obj) { // A cheaper alternative to Object.ReferenceEquals() is used here for better perf if (obj == (object)this) { return true; } else { ValidationResult vr = obj as ValidationResult; if (vr != null) { return (IsValid == vr.IsValid) && (ErrorContent == vr.ErrorContent); } } return false; } ////// Hash function for ValidationResult /// ///hash code for the current ValidationResult public override int GetHashCode() { return IsValid.GetHashCode() ^ ((ErrorContent == null) ? int.MinValue : ErrorContent).GetHashCode(); } private bool _isValid; private object _errorContent; private static readonly ValidationResult s_valid = new ValidationResult(true, null); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // //// Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // // // // Description: // A ValidationResult is the result of call to ValidationRule.Validate // // See specs at http://avalon/connecteddata/M5%20Specs/Validation.mht // // History: // 5/3/2004 mharper: created. // //--------------------------------------------------------------------------- using System; namespace System.Windows.Controls { ////// A ValidationResult is the result of call to ValidationRule.Validate /// public class ValidationResult { ////// Constructor /// public ValidationResult(bool isValid, object errorContent) { _isValid = isValid; _errorContent = errorContent; } ////// Whether or not the ValidationRule that was checked is valid. /// public bool IsValid { get { return _isValid; } } ////// Additional information regarding the cause of the invalid /// state of the binding that was just checked. /// public object ErrorContent { get { return _errorContent; } } ////// Returns a valid ValidationResult /// public static ValidationResult ValidResult { get { return s_valid; } } ////// Compares the parameters for value equality /// /// left operand /// right operand ///true if the values are equal public static bool operator == (ValidationResult left, ValidationResult right) { return Object.Equals(left, right); } ////// Compares the parameters for value inequality /// /// left operand /// right operand ///true if the values are not equal public static bool operator != (ValidationResult left, ValidationResult right) { return !Object.Equals(left, right); } ////// By-value comparison of ValidationResult /// ////// This method is also used indirectly from the operator overrides. /// /// ValidationResult to be compared against this ValidationRule ///true if obj is ValidationResult and has the same values public override bool Equals(object obj) { // A cheaper alternative to Object.ReferenceEquals() is used here for better perf if (obj == (object)this) { return true; } else { ValidationResult vr = obj as ValidationResult; if (vr != null) { return (IsValid == vr.IsValid) && (ErrorContent == vr.ErrorContent); } } return false; } ////// Hash function for ValidationResult /// ///hash code for the current ValidationResult public override int GetHashCode() { return IsValid.GetHashCode() ^ ((ErrorContent == null) ? int.MinValue : ErrorContent).GetHashCode(); } private bool _isValid; private object _errorContent; private static readonly ValidationResult s_valid = new ValidationResult(true, null); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ValueQuery.cs
- MaskedTextBoxDesigner.cs
- WebBrowserHelper.cs
- OrCondition.cs
- CodeDOMProvider.cs
- CheckBox.cs
- ActivityCollectionMarkupSerializer.cs
- VisualStyleRenderer.cs
- Button.cs
- WeakEventManager.cs
- BaseInfoTable.cs
- FacetEnabledSchemaElement.cs
- WebExceptionStatus.cs
- StateBag.cs
- HostExecutionContextManager.cs
- SqlDataSourceQuery.cs
- ChannelEndpointElement.cs
- ManagedFilter.cs
- XsdCachingReader.cs
- ToolStripPanelSelectionBehavior.cs
- Context.cs
- UserPersonalizationStateInfo.cs
- ValidationEventArgs.cs
- Authorization.cs
- TextSimpleMarkerProperties.cs
- PatternMatcher.cs
- WinEventQueueItem.cs
- OletxResourceManager.cs
- cryptoapiTransform.cs
- HandledEventArgs.cs
- PageThemeParser.cs
- WorkflowMarkupElementEventArgs.cs
- Encoder.cs
- ObjectListCommandEventArgs.cs
- ThreadPoolTaskScheduler.cs
- EnvironmentPermission.cs
- FakeModelItemImpl.cs
- FormatterConverter.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- EventMappingSettings.cs
- ProfileManager.cs
- OleDbWrapper.cs
- DirectoryNotFoundException.cs
- ColumnReorderedEventArgs.cs
- IListConverters.cs
- CaseCqlBlock.cs
- Tablet.cs
- WebMessageBodyStyleHelper.cs
- SettingsContext.cs
- PersonalizationEntry.cs
- XmlEntity.cs
- AtomPub10ServiceDocumentFormatter.cs
- CookieHandler.cs
- HtmlTable.cs
- CheckBox.cs
- XPathQilFactory.cs
- XmlILModule.cs
- ValidatingReaderNodeData.cs
- TransportConfigurationTypeElement.cs
- UnaryNode.cs
- ModelVisual3D.cs
- WindowInteractionStateTracker.cs
- ContainerUtilities.cs
- EditingContext.cs
- PointAnimationBase.cs
- MenuItemBindingCollection.cs
- SmtpDateTime.cs
- RichTextBox.cs
- XamlGridLengthSerializer.cs
- AQNBuilder.cs
- BulletChrome.cs
- CommandField.cs
- ResourceProperty.cs
- WsdlBuildProvider.cs
- RadioButtonPopupAdapter.cs
- RegisteredExpandoAttribute.cs
- GcHandle.cs
- StringFunctions.cs
- EntityDataSourceDesigner.cs
- ProcessHostConfigUtils.cs
- VirtualPath.cs
- ColorInterpolationModeValidation.cs
- DataGridPagerStyle.cs
- ControlBuilder.cs
- OperationCanceledException.cs
- DataSourceCacheDurationConverter.cs
- EntityDataSourceView.cs
- Span.cs
- ProfileGroupSettings.cs
- CngProvider.cs
- EmbeddedMailObjectsCollection.cs
- RootContext.cs
- ContentPresenter.cs
- DocumentCollection.cs
- TrackingRecord.cs
- PrePrepareMethodAttribute.cs
- documentsequencetextview.cs
- PathParser.cs
- CodeDefaultValueExpression.cs
- SchemaNamespaceManager.cs