DataColumnMappingCollection.Contains Yöntem
Tanım
Bir nesnenin koleksiyonda mevcut olup olmadığını gösteren bir değer alır DataColumnMapping .Gets a value indicating whether a DataColumnMapping object exists in the collection.
Aşırı Yüklemeler
Contains(Object) |
Koleksiyonda verilen bir nesnenin var olup olmadığını gösteren bir değer alır DataColumnMapping Object .Gets a value indicating whether a DataColumnMapping object with the given Object exists in the collection. |
Contains(String) |
DataColumnMappingBelirtilen kaynak sütun adına sahip bir nesnenin koleksiyonda mevcut olup olmadığını gösteren bir değer alır.Gets a value indicating whether a DataColumnMapping object with the given source column name exists in the collection. |
Contains(Object)
Koleksiyonda verilen bir nesnenin var olup olmadığını gösteren bir değer alır DataColumnMapping Object .Gets a value indicating whether a DataColumnMapping object with the given Object exists in the collection.
public:
virtual bool Contains(System::Object ^ value);
public bool Contains (object? value);
public bool Contains (object value);
abstract member Contains : obj -> bool
override this.Contains : obj -> bool
Public Function Contains (value As Object) As Boolean
Parametreler
- value
- Object
ObjectBu, DataColumnMapping .An Object that is the DataColumnMapping.
Döndürülenler
true
koleksiyon belirtilen DataColumnMapping nesneyi içeriyorsa; Aksi takdirde, false
.true
if the collection contains the specified DataColumnMapping object; otherwise, false
.
Uygulamalar
Özel durumlar
Geçirilen nesne bir DataColumnMapping nesne değil.The object passed in was not a DataColumnMapping object.
Örnekler
Aşağıdaki örnek koleksiyon içinde bir arar DataColumnMapping .The following example searches for a DataColumnMapping within the collection. Eşleme koleksiyonda varsa, kaldırılır.If the mapping exists in the collection, it is removed. Eşleme koleksiyon içinde yoksa, koleksiyona eklenir ve dizini görüntülenir.If the mapping does not exist within the collection, it is added to the collection and its index is displayed. Örnek, bir DataColumnMappingCollection koleksiyonun ve bir DataColumnMapping nesnenin oluşturulduğunu varsayar.The example assumes that a DataColumnMappingCollection collection and a DataColumnMapping object have been created.
public void ChangedMyMind()
{
// ...
// create mappings and mapping
// ...
if (mappings.Contains((Object) mapping))
{
mappings.Remove((Object) mapping);
}
else
{
mappings.Add((Object) mapping);
Console.WriteLine("Index of new mapping: " +
mappings.IndexOf((Object) mapping));
}
}
Public Sub ChangedMyMind()
' ...
' create mappings and mapping
' ...
If mappings.Contains(CType(mapping, Object)) Then
mappings.Remove(CType(mapping, Object))
Else
mappings.Add(CType(mapping, Object))
Console.WriteLine("Index of new mapping: " & _
mappings.IndexOf(CType(mapping, Object)).ToString())
End If
End Sub
Ayrıca bkz.
Şunlara uygulanır
Contains(String)
DataColumnMappingBelirtilen kaynak sütun adına sahip bir nesnenin koleksiyonda mevcut olup olmadığını gösteren bir değer alır.Gets a value indicating whether a DataColumnMapping object with the given source column name exists in the collection.
public:
virtual bool Contains(System::String ^ value);
public bool Contains (string? value);
public bool Contains (string value);
abstract member Contains : string -> bool
override this.Contains : string -> bool
Public Function Contains (value As String) As Boolean
Parametreler
- value
- String
Nesnenin büyük/küçük harf duyarlı kaynak sütun adı DataColumnMapping .The case-sensitive source column name of the DataColumnMapping object.
Döndürülenler
true
koleksiyon DataColumnMapping belirtilen kaynak sütun adına sahip bir nesne içeriyorsa; Aksi takdirde, false
.true
if collection contains a DataColumnMapping object with the specified source column name; otherwise, false
.
Uygulamalar
Örnekler
Aşağıdaki örnek, DataColumnMapping bir koleksiyon içinde verilen kaynak sütun adına sahip bir nesne arar DataColumnMappingCollection .The following example searches for a DataColumnMapping object with the given source column name within a DataColumnMappingCollection collection. Varsa DataColumnMapping , örnek, eşlemenin adını ve dizinini görüntüler.If the DataColumnMapping exists, the example displays the name and the index of the mapping. Eşleme yoksa, örnek bir hata görüntüler.If the mapping does not exist, the example displays an error. Bu örnek DataColumnMappingCollection , bir koleksiyonun oluşturulduğunu varsayar.This example assumes that a DataColumnMappingCollection collection has been created.
public void FindDataColumnMapping()
{
// ...
// create columnMappings
// ...
if (!columnMappings.Contains("Description"))
{
Console.WriteLine("Error: no such table in collection.");
}
else
{
Console.WriteLine("Name {0}",
columnMappings["Description"].ToString());
Console.WriteLine("Index: {0}",
columnMappings.IndexOf("Description").ToString());
}
}
Public Sub FindDataColumnMapping()
' ...
' create columnMappings
' ...
If Not columnMappings.Contains("Description") Then
Console.WriteLine("Error: no such table in collection.")
Else
Console.WriteLine("Name: {0}", _
columnMappings("Description").ToString())
Console.WriteLine("Index: {0}", _
columnMappings.IndexOf("Description").ToString())
End If
End Sub