Xceed.Silverlight.Data.v2.0 Assembly > Xceed.Silverlight.Data.Stats Namespace > StatFunction Class : IsEquivalent Method |
'Declaration Protected Friend Overridable Function IsEquivalent( _ ByVal statFunction As StatFunction _ ) As Boolean
'Usage Dim instance As StatFunction Dim statFunction As StatFunction Dim value As Boolean value = instance.IsEquivalent(statFunction)
protected internal virtual bool IsEquivalent( StatFunction statFunction )
By default, this method verifies if the type of the statistical functions and the values of the SourcePropertyName properties are identical.
The IsEquivalent and GetEquivalenceKey methods are similar to the Equals and GetHashCode methods
The GetEquivalenceKey method should return the same value for two statistical function instances that would return the same result for the same value list. All properties that have an impact on the result should be reflected in the override. If a property does not impact the result, it should not modify the equivalence key.
The IsEquivalent method should compare each property that affects the function's result and return true if they are all equal.
For instance, the CountFunction's override of the GetEquivalenceKey method will return a combination of typeof(CountFunction).GetHashCode(), SourcePropertyName.GetHashCode(), and IncludeNullValues.GetHashCode(). This means that two CountFunction instances that have the same values for the SourcePropertyName and IncludeNullValues properties will return the same equivalence key. A hypothetical "LogResult" property that does not have an effect on the result would not be considered in this override.
Similarly, the IsEquivalent method will return false if any of these 3 criteria (StatFunction type, SourcePropertyName, or IncludeNullValues) are different when compared with the specified StatFunction parameter.
When deriving from the StatFunction class, the IsEquivalent method should be overridden only if a property that affects the end result is added. In this case, GetEquivalenceKey should also be overridden to return a new key.
Target Platforms: Windows 7, Windows Vista, Windows XP SP3, Windows Server 2008 family