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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MetadataWorkspace.cs
- ECDiffieHellman.cs
- ToolStripDropDownItemDesigner.cs
- HtmlLink.cs
- MediaPlayerState.cs
- XmlDocument.cs
- EncodingInfo.cs
- ObjectDataSourceView.cs
- SoapIgnoreAttribute.cs
- ChtmlTextWriter.cs
- MatrixCamera.cs
- PathSegmentCollection.cs
- VectorValueSerializer.cs
- AvtEvent.cs
- ReadWriteObjectLock.cs
- ErrorItem.cs
- TypeGeneratedEventArgs.cs
- ColumnWidthChangedEvent.cs
- BindingCollection.cs
- SettingsPropertyValueCollection.cs
- ConfigXmlComment.cs
- IndicShape.cs
- VirtualPath.cs
- ToolStripAdornerWindowService.cs
- TextServicesPropertyRanges.cs
- TimeSpanSecondsConverter.cs
- ExtractedStateEntry.cs
- FontUnit.cs
- ScaleTransform.cs
- Operand.cs
- PropertySet.cs
- PartialArray.cs
- Random.cs
- SafeNativeMethodsCLR.cs
- DesignerAdapterUtil.cs
- AssociationProvider.cs
- ListItemCollection.cs
- FormView.cs
- WorkflowApplicationUnhandledExceptionEventArgs.cs
- ControlParameter.cs
- PrePrepareMethodAttribute.cs
- TokenizerHelper.cs
- NameValueCollection.cs
- SQLConvert.cs
- ArraySortHelper.cs
- CardSpaceShim.cs
- WebControlParameterProxy.cs
- SemanticResolver.cs
- SAPICategories.cs
- SQLInt16Storage.cs
- PackageRelationshipCollection.cs
- WizardForm.cs
- DbParameterHelper.cs
- SystemIPAddressInformation.cs
- BufferModeSettings.cs
- NavigatingCancelEventArgs.cs
- EntityDataSourceDataSelection.cs
- TextBlockAutomationPeer.cs
- DynamicRouteExpression.cs
- SqlNotificationRequest.cs
- EqualityComparer.cs
- EntityRecordInfo.cs
- Context.cs
- ViewEvent.cs
- ComponentEditorPage.cs
- HostingPreferredMapPath.cs
- OleAutBinder.cs
- HttpException.cs
- WorkflowHostingEndpoint.cs
- HttpRuntimeSection.cs
- X509CertificateValidator.cs
- MetadataSource.cs
- TypeConstant.cs
- PrintDialogException.cs
- GeneralTransformCollection.cs
- Config.cs
- CodeDirectoryCompiler.cs
- SrgsElementList.cs
- AnnotationAuthorChangedEventArgs.cs
- ItemCheckedEvent.cs
- SystemTcpConnection.cs
- SignerInfo.cs
- ColorMatrix.cs
- EndpointIdentityExtension.cs
- XmlParserContext.cs
- TaskFileService.cs
- Crypto.cs
- PropertyTabChangedEvent.cs
- DaylightTime.cs
- XmlTextReaderImplHelpers.cs
- PropertyChange.cs
- SrgsDocumentParser.cs
- XmlSchemaComplexType.cs
- XPathBinder.cs
- MdiWindowListStrip.cs
- LineVisual.cs
- Rect.cs
- Point3DAnimationUsingKeyFrames.cs
- ToolStripItemClickedEventArgs.cs
- DiagnosticStrings.cs