作者:VB.NET开发
项目:System.Workflow.ComponentModel.Desig
Sub ValidateIdentifier(ByVal activity As Activity, ByVal identifier As String) Implements IIdentifierCreationService.ValidateIdentifier
If identifier Is Nothing Then
Throw New ArgumentNullException("identifier")
End If
If activity Is Nothing Then
Throw New ArgumentNullException("activity")
End If
If activity.Name.ToLower().Equals(identifier.ToLower()) Then
Return
End If
Dim identifiers As New ArrayList()
Dim rootActivity As Activity = GetRootActivity(activity)
identifiers.AddRange(GetIdentifiersInCompositeActivity(CType(rootActivity, CompositeActivity)))
identifiers.Sort()
If identifiers.BinarySearch(identifier.ToLower(), StringComparer.OrdinalIgnoreCase) >= 0 Then
Throw New ArgumentException(String.Format("Duplicate Component Identifier 0}", identifier))
End If
End Sub