Helper.Compare Method (WorkflowContext, String, Object, Object)
Compares two objects by using a string that represents an evaluation operator and the WorkflowContext, in order to retrieve properties from the active workflow instance.
Namespace: Microsoft.SharePoint.WorkflowActions
Assembly: Microsoft.SharePoint.WorkflowActions (in Microsoft.SharePoint.WorkflowActions.dll)
Syntax
'Declaration
Public Shared Function Compare ( _
context As WorkflowContext, _
comparison As String, _
lhsValue As Object, _
rhsValue As Object _
) As Boolean
'Usage
Dim context As WorkflowContext
Dim comparison As String
Dim lhsValue As Object
Dim rhsValue As Object
Dim returnValue As Boolean
returnValue = Helper.Compare(context, _
comparison, lhsValue, rhsValue)
public static bool Compare(
WorkflowContext context,
string comparison,
Object lhsValue,
Object rhsValue
)
Parameters
context
Type: Microsoft.SharePoint.WorkflowActions.WorkflowContextWorkflowContext object that contains properties that are associated with the active workflow instance.
comparison
Type: System.StringA string that represents a comparison operator.
Equal
Compares lhsValue and rhsValue, matching their case, and using culture-specific information to determine equality (exact match).
EqualNoCase
Compares lhsValue and rhsValue, ignoring their case, and using culture-specific information to determine equality (exact match).
NotEqual
Compares lhsValue and rhsValue, matching their case, and using culture-specific information to determine if they are not equal.
NotEqualNoCase
Compares lhsValue and rhsValue, ignoring their case, and using culture-specific information to determine if they are not equal.
StartsWith
Compares lhsValue and rhsValue to determine whether the beginning of lhsValue matches rhsValue when compared by using current culture information.
NotStartsWith
Compares lhsValue and rhsValue to determine whether the beginning of lhsValue does not match rhsValue when compared by using current culture information.
EndsWith
Compares lhsValue and rhsValue to determine whether the end of the lhsValue matches the string that is on the right side of the comparison operator. These are compared by using current culture information.
NotEndsWith
Compares lhsValue and rhsValue to determine whether the end of the lhsValue does not match the string that is on the right side of the comparison operator. These are compared by using current culture information.
Contains
Compares lhsValue and rhsValue to determine if lhsValue contains any or all of the rhsValue.
NotContains
Compares lhsValue and rhsValue to determine if lhsValue does not contain any or all of the rhsValue.
ContainsNoCase
Compares lhsValue and rhsValue to determine if lhsValue contains any or all of the rhsValue. Uses the invariant culture and ignores the case of the strings being compared.
Matches
Determines whether the two supplied values contain a pattern match.
IsEmpty
Returns true if lhsValue is found to be a null reference (Nothing in Visual Basic), or its length is zero.
lhsValue
Type: System.ObjectThe value on the left side of the equation, which is evaluated during the execution of the Compare method.
rhsValue
Type: System.ObjectThe value on the right side of the equation, which is evaluated during the execution of the Compare method.
Return Value
Type: System.Boolean
true if values are equal; otherwise, the value is false.
Remarks
The Compare method essentially evaluates an equation similar to x = y, where x is the left side of the equation, y is the right side and = is the operator.
In a code-free workflow editor it is sometimes necessary to create a condition that is used to determine if a workflow activity should be executed, based on a specified criteria. If a condition is satisfied, it can cause a workflow activity to execute or not.
Use the CompareCompare method to create one of these conditions.