Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- FilterException.cs
- HttpConfigurationContext.cs
- EnvironmentPermission.cs
- StorageEntityContainerMapping.cs
- IssuanceTokenProviderBase.cs
- SuppressMergeCheckAttribute.cs
- SiteIdentityPermission.cs
- ConfigPathUtility.cs
- SpecularMaterial.cs
- QueueProcessor.cs
- ACE.cs
- MissingMemberException.cs
- X509LogoTypeExtension.cs
- PolygonHotSpot.cs
- CommandBindingCollection.cs
- BulletChrome.cs
- ModulesEntry.cs
- RegexWorker.cs
- WindowsGraphics2.cs
- Rect3D.cs
- CheckBoxPopupAdapter.cs
- XhtmlBasicCommandAdapter.cs
- SqlDeflator.cs
- DPCustomTypeDescriptor.cs
- SiteIdentityPermission.cs
- PerformanceCounterManager.cs
- Properties.cs
- FixedSOMPage.cs
- RulePatternOps.cs
- BidPrivateBase.cs
- DesignerTextWriter.cs
- HttpWebRequest.cs
- XmlSerializerNamespaces.cs
- CodeSnippetStatement.cs
- CaseInsensitiveComparer.cs
- GridViewHeaderRowPresenter.cs
- PropertyReferenceSerializer.cs
- HttpModuleActionCollection.cs
- NetPeerTcpBinding.cs
- DbConnectionPoolGroup.cs
- MatrixCamera.cs
- LinkTarget.cs
- RowsCopiedEventArgs.cs
- XmlSchemaSequence.cs
- PersonalizationProvider.cs
- ListViewInsertedEventArgs.cs
- PrincipalPermission.cs
- TagNameToTypeMapper.cs
- Message.cs
- HtmlTableCell.cs
- StorageComplexPropertyMapping.cs
- ShapingWorkspace.cs
- EventLogPermissionAttribute.cs
- DataStorage.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- ReadOnlyNameValueCollection.cs
- XmlElementList.cs
- OperationInfo.cs
- SessionEndedEventArgs.cs
- DomNameTable.cs
- ProcessProtocolHandler.cs
- Number.cs
- ModelPropertyDescriptor.cs
- ContextStack.cs
- RoleGroupCollection.cs
- BatchServiceHost.cs
- HttpRuntime.cs
- Comparer.cs
- PermissionRequestEvidence.cs
- FunctionGenerator.cs
- TraceHandler.cs
- Page.cs
- DetailsViewInsertedEventArgs.cs
- FragmentQueryKB.cs
- CompositeDataBoundControl.cs
- MatrixUtil.cs
- ProjectedSlot.cs
- FileVersion.cs
- MarkupProperty.cs
- PowerStatus.cs
- ImageSource.cs
- CodeMethodReturnStatement.cs
- FloatMinMaxAggregationOperator.cs
- BindingManagerDataErrorEventArgs.cs
- FormViewUpdatedEventArgs.cs
- ResourceDescriptionAttribute.cs
- UserControlBuildProvider.cs
- XmlQueryOutput.cs
- ManagementNamedValueCollection.cs
- CompareInfo.cs
- FontFamilyConverter.cs
- DesignerAttribute.cs
- Trigger.cs
- typedescriptorpermissionattribute.cs
- RowCache.cs
- DrawItemEvent.cs
- WriteFileContext.cs
- DataBinding.cs
- DataBindingHandlerAttribute.cs
- ReflectionHelper.cs