共用方式為


ICursor.GetColumnIndex(String) Method

Definition

Returns the zero-based index for the given column name, or -1 if the column doesn't exist.

[Android.Runtime.Register("getColumnIndex", "(Ljava/lang/String;)I", "GetGetColumnIndex_Ljava_lang_String_Handler:Android.Database.ICursorInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int GetColumnIndex (string? columnName);
[<Android.Runtime.Register("getColumnIndex", "(Ljava/lang/String;)I", "GetGetColumnIndex_Ljava_lang_String_Handler:Android.Database.ICursorInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetColumnIndex : string -> int

Parameters

columnName
String

the name of the target column.

Returns

the zero-based column index for the given column name, or -1 if the column name does not exist.

Attributes

Remarks

Returns the zero-based index for the given column name, or -1 if the column doesn't exist. If you expect the column to exist use #getColumnIndexOrThrow(String) instead, which will make the error more clear.

Java documentation for android.database.Cursor.getColumnIndex(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also