ContractDescription.HasProtectionLevel 属性

定义

获取指示协定是否已经设置了保护级别的值。

public:
 property bool HasProtectionLevel { bool get(); };
public bool HasProtectionLevel { get; }
member this.HasProtectionLevel : bool
Public ReadOnly Property HasProtectionLevel As Boolean

属性值

Boolean

如果已经设置了保护级别,则为 true,否则为 false

示例

bool hasProtectionLevel = cd.HasProtectionLevel;
if (hasProtectionLevel)
{
    ProtectionLevel protectionLevel = cd.ProtectionLevel;
    Console.WriteLine("\tProtection Level: {0}", protectionLevel.ToString());
}
Dim hasProtectionLevel As Boolean = cd.HasProtectionLevel
If hasProtectionLevel Then
    Dim protectionLevel As ProtectionLevel = cd.ProtectionLevel
    Console.WriteLine(Constants.vbTab & "Protection Level: {0}", protectionLevel.ToString())
End If

注解

如果设置了 ProtectionLevel,则 HasProtectionLevel 属性设置为 true

适用于