Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / 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 [....]/connecteddata/M5%20Specs/Validation.mht // // History: // 5/3/2004 [....]: 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
- MSAAEventDispatcher.cs
- DefaultClaimSet.cs
- _Connection.cs
- TrackingMemoryStreamFactory.cs
- FontStyle.cs
- TreeViewCancelEvent.cs
- RouteParameter.cs
- BindingValueChangedEventArgs.cs
- SqlBulkCopyColumnMapping.cs
- MeasureItemEvent.cs
- SessionEndingEventArgs.cs
- OneWayElement.cs
- InstanceOwnerQueryResult.cs
- CmsInterop.cs
- TextMarkerSource.cs
- FacetEnabledSchemaElement.cs
- ExceptionHandlers.cs
- TraceUtility.cs
- DataGridViewCellFormattingEventArgs.cs
- EventLogPermissionEntry.cs
- ThumbAutomationPeer.cs
- ActiveXContainer.cs
- MemberHolder.cs
- ScriptControlDescriptor.cs
- AppDomainUnloadedException.cs
- Decoder.cs
- SHA256Managed.cs
- GenericAuthenticationEventArgs.cs
- BulletedListDesigner.cs
- UndoManager.cs
- HttpCookiesSection.cs
- KeyboardDevice.cs
- mongolianshape.cs
- FontFamilyIdentifier.cs
- wmiprovider.cs
- Internal.cs
- SQLInt64Storage.cs
- GridViewDesigner.cs
- HyperLink.cs
- fixedPageContentExtractor.cs
- BrowserCapabilitiesCodeGenerator.cs
- DisposableCollectionWrapper.cs
- EndEvent.cs
- BlurEffect.cs
- HtmlHistory.cs
- FormsIdentity.cs
- ConstNode.cs
- DbExpressionVisitor.cs
- Matrix3D.cs
- PropertyDescriptorGridEntry.cs
- PermissionAttributes.cs
- PropertyToken.cs
- GridSplitterAutomationPeer.cs
- SigningCredentials.cs
- SqlRecordBuffer.cs
- BrowserInteropHelper.cs
- RegistrationServices.cs
- StylusDownEventArgs.cs
- RootCodeDomSerializer.cs
- GenericEnumConverter.cs
- SessionStateUtil.cs
- NativeMethods.cs
- X509UI.cs
- ResXDataNode.cs
- WaitHandle.cs
- ExceptionHandler.cs
- FrameworkTemplate.cs
- ProxyGenerator.cs
- Image.cs
- IFormattable.cs
- DataGridLengthConverter.cs
- VirtualDirectoryMapping.cs
- DataSourceGeneratorException.cs
- MemberHolder.cs
- SystemDiagnosticsSection.cs
- UserCancellationException.cs
- XmlBaseReader.cs
- DataExchangeServiceBinder.cs
- ExpressionConverter.cs
- ItemsPresenter.cs
- XmlMembersMapping.cs
- MonitoringDescriptionAttribute.cs
- WebExceptionStatus.cs
- XPathDocument.cs
- HtmlGenericControl.cs
- JournalNavigationScope.cs
- NavigatorInput.cs
- RegexWriter.cs
- TextServicesProperty.cs
- MaskPropertyEditor.cs
- ParameterCollection.cs
- TraceHandlerErrorFormatter.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- SvcMapFile.cs
- TableCellCollection.cs
- HtmlTernaryTree.cs
- PlatformNotSupportedException.cs
- OSFeature.cs
- IteratorDescriptor.cs
- ValueType.cs