IndexOutOfRangeException Konstruktorer

Definition

Initierar en ny instans av IndexOutOfRangeException klassen.

Överlagringar

Name Description
IndexOutOfRangeException()

Initierar en ny instans av IndexOutOfRangeException klassen.

IndexOutOfRangeException(String)

Initierar en ny instans av IndexOutOfRangeException klassen med ett angivet felmeddelande.

IndexOutOfRangeException(String, Exception)

Initierar en ny instans av IndexOutOfRangeException klassen med ett angivet felmeddelande och en referens till det inre undantaget som är orsaken till det här undantaget.

IndexOutOfRangeException()

Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs

Initierar en ny instans av IndexOutOfRangeException klassen.

public:
 IndexOutOfRangeException();
public IndexOutOfRangeException();
Public Sub New ()

Kommentarer

Den här konstruktorn initierar egenskapen för den nya instansen Message till ett meddelande från systemet som beskriver felet, till exempel "Ett matrisindex ligger utom räckhåll". Det här meddelandet tar hänsyn till den aktuella systemkulturen.

I följande tabell visas de inledande egenskapsvärdena för en instans av IndexOutOfRangeException.

Fastighet Value
InnerException En null-referens (Nothing i Visual Basic).
Message Den lokaliserade felmeddelandesträngen.

Gäller för

IndexOutOfRangeException(String)

Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs

Initierar en ny instans av IndexOutOfRangeException klassen med ett angivet felmeddelande.

public:
 IndexOutOfRangeException(System::String ^ message);
public IndexOutOfRangeException(string message);
public IndexOutOfRangeException(string? message);
new IndexOutOfRangeException : string -> IndexOutOfRangeException
Public Sub New (message As String)

Parametrar

message
String

Meddelandet som beskriver felet.

Kommentarer

Den här konstruktorn initierar egenskapen för Exception.Message det nya undantaget med hjälp av parametern message . Innehållet message i är avsett att förstås av människor. Anroparen för den här konstruktorn krävs för att säkerställa att den här strängen har lokaliserats för den aktuella systemkulturen.

I följande tabell visas de inledande egenskapsvärdena för en instans av IndexOutOfRangeException.

Fastighet Value
InnerException En null-referens (Nothing i Visual Basic).
Message Felmeddelandesträngen.

Gäller för

IndexOutOfRangeException(String, Exception)

Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs
Källa:
IndexOutOfRangeException.cs

Initierar en ny instans av IndexOutOfRangeException klassen med ett angivet felmeddelande och en referens till det inre undantaget som är orsaken till det här undantaget.

public:
 IndexOutOfRangeException(System::String ^ message, Exception ^ innerException);
public IndexOutOfRangeException(string message, Exception innerException);
public IndexOutOfRangeException(string? message, Exception? innerException);
new IndexOutOfRangeException : string * Exception -> IndexOutOfRangeException
Public Sub New (message As String, innerException As Exception)

Parametrar

message
String

Felmeddelandet som förklarar orsaken till undantaget.

innerException
Exception

Undantaget som är orsaken till det aktuella undantaget. Om parametern innerException inte är en null-referens (Nothing i Visual Basic) genereras det aktuella undantaget i ett catch-block som hanterar det inre undantaget.

Kommentarer

Ett undantag som genereras som ett direkt resultat av ett tidigare undantag bör innehålla en referens till det tidigare undantaget i InnerException egenskapen. Egenskapen InnerException returnerar samma värde som skickas till konstruktorn eller en nullreferens (Nothing i Visual Basic) om egenskapen InnerException inte anger det inre undantagsvärdet till konstruktorn.

I följande tabell visas de inledande egenskapsvärdena för en instans av IndexOutOfRangeException.

Fastighet Value
InnerException Den inre undantagsreferensen.
Message Felmeddelandesträngen.

Se även

Gäller för