Index Yapı

Tanım

Baştan veya uçtan bir koleksiyonu dizinlemek için kullanılabilecek bir türü temsil eder.Represents a type that can be used to index a collection either from the start or the end.

public value class Index : IEquatable<Index>
public struct Index : IEquatable<Index>
type Index = struct
Public Structure Index
Implements IEquatable(Of Index)
Devralma
Uygulamalar

Açıklamalar

Index Yeni dizin söz dizimini desteklemek için C# derleyicisi tarafından kullanılır:Index is used by the C# compiler to support the new index syntax:

int[] someArray = new int[5] { 1, 2, 3, 4, 5 };
int lastElement = someArray[^1]; // lastElement = 5

Oluşturucular

Index(Int32, Boolean)

IndexBelirtilen dizin konumuyla yeni bir değer ve dizinin başlangıçtan veya sonundan sonra olup olmadığını gösteren bir değer başlatır.Initializes a new Index with a specified index position and a value that indicates if the index is from the start or the end of a collection.

Özellikler

End

IndexSon öğenin ötesinde bir işaret alır.Gets an Index that points beyond the last element.

IsFromEnd

Dizinin başlangıç veya bitişten mi olduğunu gösteren bir değer alır.Gets a value that indicates whether the index is from the start or the end.

Start

IndexBir koleksiyonun ilk öğesine işaret eden bir öğesini alır.Gets an Index that points to the first element of a collection.

Value

Dizin değerini alır.Gets the index value.

Yöntemler

Equals(Index)

Geçerli nesnenin başka bir nesneye eşit olup olmadığını gösteren bir değer döndürür Index .Returns a value that indicates whether the current object is equal to another Index object.

Equals(Object)

Geçerli dizin nesnesinin belirtilen bir nesneye eşit olup olmadığını gösterir.Indicates whether the current Index object is equal to a specified object.

FromEnd(Int32)

IndexBelirtilen dizin konumunda bir koleksiyonun sonundan bir oluşturur.Creates an Index from the end of a collection at a specified index position.

FromStart(Int32)

IndexBir koleksiyonun başlangıcında belirtilen dizinden bir oluştur.Create an Index from the specified index at the start of a collection.

GetHashCode()

Bu örneğe ilişkin karma kodu döndürür.Returns the hash code for this instance.

GetOffset(Int32)

Verilen koleksiyon uzunluğunu kullanarak koleksiyonun başlangıcından itibaren sapmayı hesaplar.Calculates the offset from the start of the collection using the given collection length.

ToString()

Geçerli örneğin dize gösterimini döndürür Index .Returns the string representation of the current Index instance.

İşleçler

Implicit(Int32 to Index)

Tamsayı sayısını dizine dönüştürür.Converts integer number to an Index.

Şunlara uygulanır