Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- XMLSyntaxException.cs
- DataGridViewCellMouseEventArgs.cs
- HtmlWindowCollection.cs
- BitmapEffect.cs
- RawStylusInputCustomDataList.cs
- TransformPattern.cs
- TypeEnumerableViewSchema.cs
- ContentElementAutomationPeer.cs
- XsltLibrary.cs
- CapabilitiesUse.cs
- Logging.cs
- Aes.cs
- FileDialogCustomPlace.cs
- QilUnary.cs
- QEncodedStream.cs
- BaseTemplateParser.cs
- NetSectionGroup.cs
- TabPage.cs
- DefaultObjectMappingItemCollection.cs
- PropertyCondition.cs
- SchemaElementLookUpTable.cs
- NotImplementedException.cs
- RecordBuilder.cs
- FontSourceCollection.cs
- CaretElement.cs
- AmbientLight.cs
- PasswordBoxAutomationPeer.cs
- ColumnProvider.cs
- FamilyMapCollection.cs
- StringResourceManager.cs
- BrushConverter.cs
- ThemeableAttribute.cs
- PropagatorResult.cs
- SoapExtensionTypeElementCollection.cs
- StreamReader.cs
- PtsCache.cs
- LookupTables.cs
- ProcessHostMapPath.cs
- OperationAbortedException.cs
- CodeAccessSecurityEngine.cs
- SqlMultiplexer.cs
- CacheRequest.cs
- WebPartEditorOkVerb.cs
- DateTimeConstantAttribute.cs
- SQLSingleStorage.cs
- WindowsIPAddress.cs
- RectIndependentAnimationStorage.cs
- XPathNavigator.cs
- ValidationSummary.cs
- AnnotationAdorner.cs
- DataKeyCollection.cs
- DescendantOverDescendantQuery.cs
- DependencyPropertyValueSerializer.cs
- XmlWriterTraceListener.cs
- ContainerSelectorGlyph.cs
- DataFieldConverter.cs
- Boolean.cs
- NamespaceList.cs
- DesignTimeParseData.cs
- MenuAdapter.cs
- EntityDataSourceSelectedEventArgs.cs
- WebServiceEnumData.cs
- PerfProviderCollection.cs
- ZipIOBlockManager.cs
- PageParser.cs
- RecognizedPhrase.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- Latin1Encoding.cs
- SchemeSettingElementCollection.cs
- MultiDataTrigger.cs
- TextDataBindingHandler.cs
- ContentValidator.cs
- IgnoreSectionHandler.cs
- PropertyRef.cs
- XmlElement.cs
- DataGridViewCellStyle.cs
- InternalPolicyElement.cs
- KeyFrames.cs
- RelationshipDetailsCollection.cs
- SecureStringHasher.cs
- CapabilitiesPattern.cs
- FixedBufferAttribute.cs
- ConfigXmlWhitespace.cs
- FloaterBaseParaClient.cs
- CodeDomDesignerLoader.cs
- NotifyIcon.cs
- TableCellCollection.cs
- URLString.cs
- AssociationType.cs
- bindurihelper.cs
- SoapIgnoreAttribute.cs
- DynamicRendererThreadManager.cs
- ErrorInfoXmlDocument.cs
- ToolStripTemplateNode.cs
- DoubleCollection.cs
- GAC.cs
- StreamingContext.cs
- ButtonField.cs
- DesignSurfaceServiceContainer.cs
- ByteStorage.cs