SPContentTypeId.IsChildOf method
會指出是否指定的內容類型識別碼 (ID) 的下階目前的內容類型識別碼。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Function IsChildOf ( _
id As SPContentTypeId _
) As Boolean
'用途
Dim instance As SPContentTypeId
Dim id As SPContentTypeId
Dim returnValue As Boolean
returnValue = instance.IsChildOf(id)
public bool IsChildOf(
SPContentTypeId id
)
參數
id
Type: Microsoft.SharePoint.SPContentTypeId內容類型識別碼,若要比較目前的內容類型識別碼。
傳回值
Type: System.Boolean
從指定的內容類型識別碼 ; 衍生true若是目前的內容類型識別碼否則,請false。
備註
此方法會傳回所有目前的內容類型識別碼,而不只是立即的前置任務的前置項目true 。例如,每個在下列範例中的程式碼的最後兩行包含true評估的運算式。
SPContentTypeId x = SPBuiltInContentTypeId.Item;
SPContentTypeId y = SPBuiltInContentTypeId.Document;
SPContentTypeId z = SPBuiltInContentTypeId.BasicPage;
Console.WriteLine(z.IsChildOf(y)); // True
Console.WriteLine(z.IsChildOf(x)); // True
Dim x As SPContentTypeId = SPBuiltInContentTypeId.Item
Dim y As SPContentTypeId = SPBuiltInContentTypeId.Document
Dim z As SPContentTypeId = SPBuiltInContentTypeId.BasicPage
Console.WriteLine(z.IsChildOf(y)) ' True
Console.WriteLine(z.IsChildOf(x)) ' True
此外,此方法也會傳回true如果的內容類型識別碼值中傳遞為引數是目前的內容類型識別碼的值相同如下列範例所示。
y = x;
Console.WriteLine(x == y); // True
Console.WriteLine(y.IsChildOf(x)); // True
Console.WriteLine(x.IsChildOf(y)); // True
y = x
Console.WriteLine(x = y) ' True
Console.WriteLine(y.IsChildOf(x)) ' True
Console.WriteLine(x.IsChildOf(y)) ' True
請參閱
參照
Microsoft.SharePoint namespace