共用方式為


ModelMemberCollection<TItemType, TKeyType>.Find 方法 (String, Boolean)

在衍生類別中覆寫時,依據指定的索引鍵在集合中搜尋項目,並傳回找到的項目。

命名空間:  Microsoft.Windows.Design.Model
組件:  Microsoft.Windows.Design.Interaction (在 Microsoft.Windows.Design.Interaction.dll 中)

語法

'宣告
Protected MustOverride Function Find ( _
    name As String, _
    throwOnError As Boolean _
) As TItemType
protected abstract TItemType Find(
    string name,
    bool throwOnError
)
protected:
virtual TItemType Find(
    String^ name, 
    bool throwOnError
) abstract
abstract Find : 
        name:string * 
        throwOnError:bool -> 'TItemType 
protected abstract function Find(
    name : String, 
    throwOnError : boolean
) : TItemType

參數

  • throwOnError
    型別:System.Boolean
    如果找不到項目而應該擲回例外狀況則為 true,否則為 false。

傳回值

型別:TItemType
具有指定索引鍵的 TItemType。如果找不到,這個方法會擲回例外狀況或傳回 nullNull 參照 (即 Visual Basic 中的 Nothing),視傳遞至 throwOnError 的值而定。

例外狀況

例外狀況 條件
ArgumentException

找不到 name 且 throwOnError 為 true。

.NET Framework 安全性

請參閱

參考

ModelMemberCollection<TItemType, TKeyType> 類別

Find 多載

Microsoft.Windows.Design.Model 命名空間

其他資源

WPF 設計工具擴充性