ExtendedProperties.Contains 方法 (Guid)

指示 ExtendedProperties 集合是否包含特定的 ExtendedProperty 对象。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Function Contains ( _
    id As Guid _
) As Boolean
用法
Dim instance As ExtendedProperties
Dim id As Guid
Dim returnValue As Boolean

returnValue = instance.Contains(id)
public bool Contains(
    Guid id
)
public:
bool Contains(
    Guid id
)
public boolean Contains(
    Guid id
)
public function Contains(
    id : Guid
) : boolean

参数

返回值

类型:System.Boolean
如果 ExtendedProperties 集合包含特定的 ExtendedProperty 对象,则为 true;否则为 false。

示例

此示例检查 Strokes 集合中的每个 Stroke 对象。如果 StrokeExtendedProperties 包含与特殊时间戳 Guid 对象关联的属性,则从集合中移除该 ExtendedProperty

Private Sub RemoveAllTimeStampProperties()
    ' STROKE_START_GUID and STROKE_END_GUID
    ' are class level string const set via GUID generator
    Dim strokeStartGuid As Guid = New Guid(STROKE_START_GUID)
    Dim strokeEndGuid As Guid = New Guid(STROKE_END_GUID)

    ' access the Strokes property via using statement
    ' to insure that the object mStrokes is disposed when finished
    ' Otherwise, you will have a memory leak
    Using mStrokes As Strokes = mInkObject.Ink.Strokes
        For Each S As Stroke In mStrokes
            If S.ExtendedProperties.Contains(strokeStartGuid) Then
                S.ExtendedProperties.Remove(strokeStartGuid)
            End If
            If S.ExtendedProperties.Contains(strokeEndGuid) Then
                S.ExtendedProperties.Remove(strokeEndGuid)
            End If
        Next
    End Using
End Sub
private void RemoveAllTimeStampProperties()
{
    // STROKE_START_GUID and STROKE_END_GUID
    // are class level string const set via GUID generator
    Guid strokeStartGuid = new Guid(STROKE_START_GUID);
    Guid strokeEndGuid = new Guid(STROKE_END_GUID);

    // access the Strokes property via using statement
    // to insure that the object mStrokes is disposed when finished
    // Otherwise, you will have a memory leak
    using (Strokes mStrokes = mInkObject.Ink.Strokes)
    {
        foreach (Stroke S in mStrokes)
        {
            if (S.ExtendedProperties.Contains(strokeStartGuid))
            {
                S.ExtendedProperties.Remove(strokeStartGuid);
            }
            if (S.ExtendedProperties.Contains(strokeEndGuid))
            {
                S.ExtendedProperties.Remove(strokeEndGuid);
            }
        }
    }
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

ExtendedProperties 类

ExtendedProperties 成员

Contains 重载

Microsoft.Ink 命名空间

ExtendedProperty