共用方式為


AdoDotNetObjectItemComparer.Compare 方法 (String, array<Object[], Int32, Object)

將物件識別項組件與另一個指定的物件識別項 (OID) 組件比較。

命名空間:  Microsoft.VisualStudio.Data.AdoDotNet
組件:  Microsoft.VisualStudio.Data (在 Microsoft.VisualStudio.Data.dll 中)

語法

'宣告
Public Overrides Function Compare ( _
    typeName As String, _
    identifier As Object(), _
    identifierPart As Integer, _
    value As Object _
) As Integer
public override int Compare(
    string typeName,
    Object[] identifier,
    int identifierPart,
    Object value
)
public:
virtual int Compare(
    String^ typeName, 
    array<Object^>^ identifier, 
    int identifierPart, 
    Object^ value
) override
abstract Compare : 
        typeName:string * 
        identifier:Object[] * 
        identifierPart:int * 
        value:Object -> int  
override Compare : 
        typeName:string * 
        identifier:Object[] * 
        identifierPart:int * 
        value:Object -> int
public override function Compare(
    typeName : String, 
    identifier : Object[], 
    identifierPart : int, 
    value : Object
) : int

參數

  • typeName
    類型:String

    物件型別名稱。

  • identifier
    類型:array<Object[]

    型別物件的識別項 typeName 參數所指定的。

  • identifierPart
    類型:Int32

    以零起始的索引設定為數值識別項的哪個部分識別項陣列中的比較。

  • value
    類型:Object

    比較識別組件的值。

傳回值

類型:Int32
識別項中部分大於指定之處,就傳回小於零。如果識別項組件具有指定值,等於傳回零。如果識別項部分大於指定值,則會傳回大於零。

例外狀況

例外狀況 條件
ArgumentNullException

typeName 和 identifier 參數為 null。

ArgumentOutOfRangeException

identifier 參數小於零或是大於或等於中的項目數目 (在識別項的陣列。

備註

這個方法應使用比較規則與資料來源相同確保正確的物件唯一在用戶端執行。

傳入完整的來源識別項,某些複雜情況中進行處理。 整個,例如 Microsoft SQL Server 的最新版本可讓伺服器位於識別項的比較,當伺服器上的特定資料庫可能是不區分大小寫時的大小寫,否則反之亦然區分大小寫。 這表示,當比較的資料表 (會以完整的資料表識別項的第二個和第三個部分中,第一個部分的結構描述名稱或資料庫),這個方法的實作必須使用資料庫資料表是的第一個識別項組件和計算,因此使用何種比較。

這個實作會從 ADO.NET 資料來源資訊資料表擷取 IdentifierCase 資料來源資訊屬性並使用值來判斷是否區分大小寫的比較是否獲得認可。

.NET Framework 安全性

請參閱

參考

AdoDotNetObjectItemComparer 類別

Compare 多載

Microsoft.VisualStudio.Data.AdoDotNet 命名空間

IComparable

Compare