TypeBinaryExpression Classe
Definição
Representa uma operação entre uma expressão e um tipo.Represents an operation between an expression and a type.
public ref class TypeBinaryExpression sealed : System::Linq::Expressions::Expression
public sealed class TypeBinaryExpression : System.Linq.Expressions.Expression
type TypeBinaryExpression = class
inherit Expression
Public NotInheritable Class TypeBinaryExpression
Inherits Expression
- Herança
Exemplos
O exemplo a seguir cria um TypeBinaryExpression objeto que representa um teste de tipo de um valor de cadeia de caracteres em relação ao Int32 tipo.The following example creates a TypeBinaryExpression object that represents a type test of a string value against the Int32 type.
// Create a TypeBinaryExpression that represents a
// type test of the string "spruce" against the 'int' type.
System.Linq.Expressions.TypeBinaryExpression typeBinaryExpression =
System.Linq.Expressions.Expression.TypeIs(
System.Linq.Expressions.Expression.Constant("spruce"),
typeof(int));
Console.WriteLine(typeBinaryExpression.ToString());
// This code produces the following output:
//
// ("spruce" Is Int32)
' Create a TypeBinaryExpression that represents a
' type test of the String "spruce" against the Int32 type.
Dim typeBinaryExpression As System.Linq.Expressions.TypeBinaryExpression = _
System.Linq.Expressions.Expression.TypeIs( _
System.Linq.Expressions.Expression.Constant("spruce"), _
Type.GetType("System.Int32"))
Console.WriteLine(typeBinaryExpression.ToString())
' This code produces the following output:
'
' ("spruce" Is Int32)
Comentários
Um teste de tipo é um exemplo de uma operação entre uma expressão e um tipo.A type test is an example of an operation between an expression and a type.
Use o TypeIs método de fábrica para criar um TypeBinaryExpression .Use the TypeIs factory method to create a TypeBinaryExpression.
O valor da NodeType propriedade de um TypeBinaryExpression objeto é TypeIs .The value of the NodeType property of a TypeBinaryExpression object is TypeIs.
Propriedades
| CanReduce |
Indica que o nó pode ser reduzido a um nó mais simples.Indicates that the node can be reduced to a simpler node. Se isso retornar verdadeiro, Reduce() poderá ser chamado para produzir a forma reduzida.If this returns true, Reduce() can be called to produce the reduced form. (Herdado de Expression) |
| Expression |
Obtém o operando de expressão de uma operação de teste de tipo.Gets the expression operand of a type test operation. |
| NodeType |
Retorna o tipo de nó dessa Expressão.Returns the node type of this Expression. Nós de extensão devem retornar Extension ao substituírem esse método.Extension nodes should return Extension when overriding this method. |
| NodeType |
Obtém o tipo de nó deste Expression.Gets the node type of this Expression. (Herdado de Expression) |
| Type |
Obtém o tipo estático da expressão que esse Expression representa.Gets the static type of the expression that this Expression represents. |
| Type |
Obtém o tipo estático da expressão que esse Expression representa.Gets the static type of the expression that this Expression represents. (Herdado de Expression) |
| TypeOperand |
Obtém o operando de tipo de uma operação de teste de tipo.Gets the type operand of a type test operation. |
Métodos
| Accept(ExpressionVisitor) |
Expede o método específico de visita para esse tipo de nó.Dispatches to the specific visit method for this node type. Por exemplo, MethodCallExpression chama o VisitMethodCall(MethodCallExpression).For example, MethodCallExpression calls the VisitMethodCall(MethodCallExpression). (Herdado de Expression) |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| Reduce() |
Reduz esse nó a uma expressão mais simples.Reduces this node to a simpler expression. Se CanReduce retornar true, ele deverá retornar uma expressão válida.If CanReduce returns true, this should return a valid expression. Esse método pode retornar outro nó que também precisa ser reduzido.This method can return another node which itself must be reduced. (Herdado de Expression) |
| ReduceAndCheck() |
Reduz esse nó a uma expressão mais simples.Reduces this node to a simpler expression. Se CanReduce retornar true, ele deverá retornar uma expressão válida.If CanReduce returns true, this should return a valid expression. Esse método pode retornar outro nó que também precisa ser reduzido.This method can return another node which itself must be reduced. (Herdado de Expression) |
| ReduceExtensions() |
Reduz a expressão a um tipo de nó conhecido (que não é um nó de extensão) ou apenas retorna a expressão se ele já é um tipo conhecido.Reduces the expression to a known node type (that is not an Extension node) or just returns the expression if it is already a known type. (Herdado de Expression) |
| ToString() |
Retorna uma representação textual de Expression.Returns a textual representation of the Expression. (Herdado de Expression) |
| Update(Expression) |
Cria uma nova expressão que é parecida com esta, mas usando os filhos fornecidos.Creates a new expression that is like this one, but using the supplied children. Se todos os filhos forem os mesmos, ela retornará esta expressão.If all of the children are the same, it will return this expression. |
| VisitChildren(ExpressionVisitor) |
Reduz o nó e, em seguida, chama o delegado visitante na expressão reduzida.Reduces the node and then calls the visitor delegate on the reduced expression. O método gera uma exceção se o nó não é reduzível.The method throws an exception if the node is not reducible. (Herdado de Expression) |