Information.IsReference(Object) Método
Definición
Devuelve un valor de tipo Boolean que indica si una expresión se evalúa como un tipo de referencia.Returns a Boolean value indicating whether an expression evaluates to a reference type.
public:
static bool IsReference(System::Object ^ Expression);
public static bool IsReference (object? Expression);
public static bool IsReference (object Expression);
static member IsReference : obj -> bool
Public Function IsReference (Expression As Object) As Boolean
Parámetros
- Expression
- Object
Obligatorio.Required. Expresión Object.Object expression.
Devoluciones
Devuelve un valor de tipo Boolean que indica si una expresión se evalúa como un tipo de referencia.Returns a Boolean value indicating whether an expression evaluates to a reference type.
Ejemplos
En este ejemplo se usa la IsReference función para comprobar si varias variables hacen referencia a tipos de referencia.This example uses the IsReference function to check if several variables refer to reference types.
Dim testArray(3) As Boolean
Dim testString As String = "Test string"
Dim testObject As Object = New Object()
Dim testNumber As Integer = 12
testArray(0) = IsReference(testArray)
testArray(1) = IsReference(testString)
testArray(2) = IsReference(testObject)
testArray(3) = IsReference(testNumber)
En el ejemplo anterior, las tres primeras llamadas a IsReference devuelven True .In the preceding example, the first three calls to IsReference return True. La última llamada devuelve False , porque Integer es un tipo de valor, no un tipo de referencia.The last call returns False, because Integer is a value type, not a reference type.
Comentarios
IsReference Devuelve True si Expression representa un tipo de referencia, como una instancia de clase, un String tipo o una matriz de cualquier tipo; de lo contrario, devuelve False .IsReference returns True if Expression represents a reference type, such as a class instance, a String type, or an array of any type; otherwise, it returns False.
Un tipo de referencia contiene un puntero a los datos almacenados en otra parte de la memoria.A reference type contains a pointer to data stored elsewhere in memory. Un tipo de valor contiene sus propios datos.A value type contains its own data.