Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Controls / ValidationResult.cs / 1305600 / 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
- TextTreeTextElementNode.cs
- IItemContainerGenerator.cs
- HyperLink.cs
- QilName.cs
- ContextInformation.cs
- BaseHashHelper.cs
- ToolStripSeparator.cs
- ContractDescription.cs
- DynamicActionMessageFilter.cs
- AccessDataSource.cs
- XsdCachingReader.cs
- SafeRightsManagementSessionHandle.cs
- WebControlAdapter.cs
- LabelLiteral.cs
- EventWaitHandle.cs
- ExtendedPropertyDescriptor.cs
- ISAPIApplicationHost.cs
- PrintDocument.cs
- SqlConnectionPoolGroupProviderInfo.cs
- NonVisualControlAttribute.cs
- BaseParser.cs
- ReceiveActivityDesignerTheme.cs
- EntityDataSourceMemberPath.cs
- Html32TextWriter.cs
- DesignerLoader.cs
- SharedConnectionListener.cs
- DynamicRendererThreadManager.cs
- QueryOperationResponseOfT.cs
- Transaction.cs
- CodeExpressionCollection.cs
- RightsManagementInformation.cs
- SettingsProperty.cs
- HeaderPanel.cs
- SchemaTypeEmitter.cs
- SerializationObjectManager.cs
- ApplicationActivator.cs
- ProfileSettingsCollection.cs
- BaseDataBoundControl.cs
- ParagraphResult.cs
- DataConnectionHelper.cs
- PersonalizationStateInfoCollection.cs
- WebFormsRootDesigner.cs
- Base64Decoder.cs
- MimeObjectFactory.cs
- ZeroOpNode.cs
- DefaultMemberAttribute.cs
- EdmType.cs
- TargetControlTypeCache.cs
- ComContractElement.cs
- TcpClientSocketManager.cs
- SecurityTokenException.cs
- RowUpdatedEventArgs.cs
- RequiredAttributeAttribute.cs
- FrameworkElementFactory.cs
- ConfigsHelper.cs
- ConfigurationSettings.cs
- FixedPosition.cs
- Pen.cs
- WasHttpModulesInstallComponent.cs
- SerializationEventsCache.cs
- TemplateContainer.cs
- SupportingTokenProviderSpecification.cs
- PaginationProgressEventArgs.cs
- XmlArrayItemAttributes.cs
- GlobalizationSection.cs
- XmlObjectSerializerReadContextComplex.cs
- XmlAtomicValue.cs
- Normalization.cs
- WinCategoryAttribute.cs
- RunInstallerAttribute.cs
- GenericUriParser.cs
- CriticalExceptions.cs
- CreateBookmarkScope.cs
- MouseGesture.cs
- CodeArrayCreateExpression.cs
- SafeMILHandle.cs
- ZipIOFileItemStream.cs
- ClusterRegistryConfigurationProvider.cs
- DeferredBinaryDeserializerExtension.cs
- ListViewUpdateEventArgs.cs
- ViewKeyConstraint.cs
- HiddenFieldDesigner.cs
- SqlRecordBuffer.cs
- DefaultBinder.cs
- OletxTransactionHeader.cs
- XmlNotation.cs
- ErrorHandlerModule.cs
- TemplatedAdorner.cs
- CodeDirectoryCompiler.cs
- VirtualizingStackPanel.cs
- FullTextBreakpoint.cs
- ToolboxItemFilterAttribute.cs
- TransactionTable.cs
- COM2PropertyPageUITypeConverter.cs
- HtmlTable.cs
- DataGridViewButtonCell.cs
- BatchWriter.cs
- ControlBuilder.cs
- ContainerParaClient.cs
- UserPreferenceChangingEventArgs.cs