Expression.ArrayIndex Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Vytvoří objekt Expression , který představuje použití operátoru indexu pole.
Přetížení
| Name | Description |
|---|---|
| ArrayIndex(Expression, Expression[]) |
MethodCallExpression Vytvoří objekt, který představuje použití operátoru indexu pole na multidimenzionální pole. |
| ArrayIndex(Expression, IEnumerable<Expression>) |
MethodCallExpression Vytvoří objekt, který představuje použití operátoru indexu pole na matici pořadí více než jeden. |
| ArrayIndex(Expression, Expression) |
BinaryExpression Vytvoří objekt, který představuje použití operátoru indexu pole na matici pořadí jedna. |
ArrayIndex(Expression, Expression[])
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
MethodCallExpression Vytvoří objekt, který představuje použití operátoru indexu pole na multidimenzionální pole.
public:
static System::Linq::Expressions::MethodCallExpression ^ ArrayIndex(System::Linq::Expressions::Expression ^ array, ... cli::array <System::Linq::Expressions::Expression ^> ^ indexes);
public static System.Linq.Expressions.MethodCallExpression ArrayIndex(System.Linq.Expressions.Expression array, params System.Linq.Expressions.Expression[] indexes);
static member ArrayIndex : System.Linq.Expressions.Expression * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.MethodCallExpression
Public Shared Function ArrayIndex (array As Expression, ParamArray indexes As Expression()) As MethodCallExpression
Parametry
- array
- Expression
Pole Expression instancí – indexy pro operaci indexu pole.
- indexes
- Expression[]
Pole Expression objektů, které se mají použít k naplnění Arguments kolekce.
Návraty
AMethodCallExpression, který má vlastnost rovna CallNodeType a Object a Arguments vlastnosti nastaveny na zadané hodnoty.
Výjimky
array nebo indexes je null.
array. Typ nepředstavuje typ pole.
nebo
Pořadí array. Typ neodpovídá počtu prvků v indexes.
nebo
Vlastnost Type jednoho nebo více prvků indexes nepředstavuje Int32 typ.
Příklady
Následující příklad ukazuje, jak použít metodu ArrayIndex(Expression, Expression[]) k vytvoření MethodCallExpression , který představuje indexování do dvojrozměrného pole.
string[,] gradeArray =
{ {"chemistry", "history", "mathematics"}, {"78", "61", "82"} };
System.Linq.Expressions.Expression arrayExpression =
System.Linq.Expressions.Expression.Constant(gradeArray);
// Create a MethodCallExpression that represents indexing
// into the two-dimensional array 'gradeArray' at (0, 2).
// Executing the expression would return "mathematics".
System.Linq.Expressions.MethodCallExpression methodCallExpression =
System.Linq.Expressions.Expression.ArrayIndex(
arrayExpression,
System.Linq.Expressions.Expression.Constant(0),
System.Linq.Expressions.Expression.Constant(2));
Console.WriteLine(methodCallExpression.ToString());
// This code produces the following output:
//
// value(System.String[,]).Get(0, 2)
Dim gradeArray(,) As String = _
{{"chemistry", "history", "mathematics"}, {"78", "61", "82"}}
Dim arrayExpression As System.Linq.Expressions.Expression = _
System.Linq.Expressions.Expression.Constant(gradeArray)
' Create a MethodCallExpression that represents indexing
' into the two-dimensional array 'gradeArray' at (0, 2).
' Executing the expression would return "mathematics".
Dim methodCallExpression As System.Linq.Expressions.MethodCallExpression = _
System.Linq.Expressions.Expression.ArrayIndex( _
arrayExpression, _
System.Linq.Expressions.Expression.Constant(0), _
System.Linq.Expressions.Expression.Constant(2))
Console.WriteLine(methodCallExpression.ToString())
' This code produces the following output:
'
' value(System.String[,]).Get(0, 2)
Poznámky
Každý prvek indexes musí mít Type rovny Int32. Vlastnost Typearray musí představovat typ pole, jehož pořadí odpovídá počtu prvků v indexes.
Je-li pořadí array. Typ je 1, tato metoda vrátí BinaryExpressionhodnotu . Vlastnost je nastavena Leftarray a Right vlastnost je nastavena na jeden prvek .indexes Vlastnost TypeBinaryExpression představuje typ arrayprvku . Typ.
Je-li pořadí array. Typ je více než jeden, tato metoda vrátí MethodCallExpression. Vlastnost Method je nastavena na MethodInfo popis veřejné instance metody Get typu reprezentované Type vlastností array.
Platí pro
ArrayIndex(Expression, IEnumerable<Expression>)
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
- Zdroj:
- MethodCallExpression.cs
MethodCallExpression Vytvoří objekt, který představuje použití operátoru indexu pole na matici pořadí více než jeden.
public:
static System::Linq::Expressions::MethodCallExpression ^ ArrayIndex(System::Linq::Expressions::Expression ^ array, System::Collections::Generic::IEnumerable<System::Linq::Expressions::Expression ^> ^ indexes);
public static System.Linq.Expressions.MethodCallExpression ArrayIndex(System.Linq.Expressions.Expression array, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> indexes);
static member ArrayIndex : System.Linq.Expressions.Expression * seq<System.Linq.Expressions.Expression> -> System.Linq.Expressions.MethodCallExpression
Public Shared Function ArrayIndex (array As Expression, indexes As IEnumerable(Of Expression)) As MethodCallExpression
Parametry
- array
- Expression
Object Nastavení Expression vlastnosti rovno.
- indexes
- IEnumerable<Expression>
Objekt IEnumerable<T> obsahující Expression objekty, které se mají použít k naplnění Arguments kolekce.
Návraty
AMethodCallExpression, který má vlastnost rovna CallNodeType a Object a Arguments vlastnosti nastaveny na zadané hodnoty.
Výjimky
array nebo indexes je null.
array. Typ nepředstavuje typ pole.
nebo
Pořadí array. Typ neodpovídá počtu prvků v indexes.
nebo
Vlastnost Type jednoho nebo více prvků indexes nepředstavuje Int32 typ.
Příklady
Následující příklad ukazuje, jak použít metodu ArrayIndex(Expression, Expression[]) k vytvoření MethodCallExpression , který představuje indexování do dvojrozměrného pole.
string[,] gradeArray =
{ {"chemistry", "history", "mathematics"}, {"78", "61", "82"} };
System.Linq.Expressions.Expression arrayExpression =
System.Linq.Expressions.Expression.Constant(gradeArray);
// Create a MethodCallExpression that represents indexing
// into the two-dimensional array 'gradeArray' at (0, 2).
// Executing the expression would return "mathematics".
System.Linq.Expressions.MethodCallExpression methodCallExpression =
System.Linq.Expressions.Expression.ArrayIndex(
arrayExpression,
System.Linq.Expressions.Expression.Constant(0),
System.Linq.Expressions.Expression.Constant(2));
Console.WriteLine(methodCallExpression.ToString());
// This code produces the following output:
//
// value(System.String[,]).Get(0, 2)
Dim gradeArray(,) As String = _
{{"chemistry", "history", "mathematics"}, {"78", "61", "82"}}
Dim arrayExpression As System.Linq.Expressions.Expression = _
System.Linq.Expressions.Expression.Constant(gradeArray)
' Create a MethodCallExpression that represents indexing
' into the two-dimensional array 'gradeArray' at (0, 2).
' Executing the expression would return "mathematics".
Dim methodCallExpression As System.Linq.Expressions.MethodCallExpression = _
System.Linq.Expressions.Expression.ArrayIndex( _
arrayExpression, _
System.Linq.Expressions.Expression.Constant(0), _
System.Linq.Expressions.Expression.Constant(2))
Console.WriteLine(methodCallExpression.ToString())
' This code produces the following output:
'
' value(System.String[,]).Get(0, 2)
Poznámky
Každý prvek indexes musí mít Type rovny Int32. Vlastnost Typearray musí představovat typ pole, jehož pořadí odpovídá počtu prvků v indexes.
Je-li pořadí array. Typ je 1, tato metoda vrátí BinaryExpressionhodnotu . Vlastnost je nastavena Leftarray a Right vlastnost je nastavena na jeden prvek .indexes Vlastnost TypeBinaryExpression představuje typ arrayprvku . Typ.
Je-li pořadí array. Typ je více než jeden, tato metoda vrátí MethodCallExpression. Vlastnost Method je nastavena na MethodInfo popis veřejné instance metody Get typu reprezentované Type vlastností array.
Platí pro
ArrayIndex(Expression, Expression)
- Zdroj:
- BinaryExpression.cs
- Zdroj:
- BinaryExpression.cs
- Zdroj:
- BinaryExpression.cs
- Zdroj:
- BinaryExpression.cs
- Zdroj:
- BinaryExpression.cs
BinaryExpression Vytvoří objekt, který představuje použití operátoru indexu pole na matici pořadí jedna.
public:
static System::Linq::Expressions::BinaryExpression ^ ArrayIndex(System::Linq::Expressions::Expression ^ array, System::Linq::Expressions::Expression ^ index);
public static System.Linq.Expressions.BinaryExpression ArrayIndex(System.Linq.Expressions.Expression array, System.Linq.Expressions.Expression index);
static member ArrayIndex : System.Linq.Expressions.Expression * System.Linq.Expressions.Expression -> System.Linq.Expressions.BinaryExpression
Public Shared Function ArrayIndex (array As Expression, index As Expression) As BinaryExpression
Parametry
- array
- Expression
A Expression nastavit Left vlastnost rovná se.
- index
- Expression
A Expression nastavit Right vlastnost rovná se.
Návraty
ABinaryExpression, který má vlastnost rovna ArrayIndexNodeType a Left a Right vlastnosti nastaveny na zadané hodnoty.
Výjimky
array nebo index je null.
array. Typ nepředstavuje typ pole.
nebo
array. Typ představuje typ pole, jehož pořadí není 1.
nebo
index. Typ nepředstavuje Int32 typ.
Poznámky
index musí představovat index typu Int32.
Vlastnost Method výsledného BinaryExpression je nulla obě IsLifted a IsLiftedToNull jsou nastaveny na false. Vlastnost Type je rovna typu arrayprvku . Typ. Vlastnost Conversion je null.