Information.IsReference(Object) 메서드
정의
식이 참조 형식으로 계산될 수 있는지 여부를 나타내는 Boolean
값을 반환합니다.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);
static member IsReference : obj -> bool
Public Function IsReference (Expression As Object) As Boolean
매개 변수
- Expression
- Object
필수 요소.Required. Object
식입니다.Object
expression.
반환
식이 참조 형식으로 계산될 수 있는지 여부를 나타내는 Boolean
값을 반환합니다.Returns a Boolean
value indicating whether an expression evaluates to a reference type.
예제
이 예제에서는 함수를 사용 하 여 IsReference
여러 변수가 참조 형식을 참조 하는지 확인 합니다.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)
앞의 예제에서를 호출 하는 처음 세 개는를 IsReference
반환 True
합니다.In the preceding example, the first three calls to IsReference
return True
. False
Integer
가 참조 형식이 아닌 값 형식 이므로 마지막 호출에서을 반환 합니다.The last call returns False
, because Integer
is a value type, not a reference type.
설명
IsReference
가 True
Expression
클래스 인스턴스, 형식 또는 형식의 배열과 같은 참조 형식을 나타내면를 반환 하 String
고, 그렇지 않으면를 반환 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
.
참조 형식에는 메모리의 다른 곳에 저장 된 데이터에 대 한 포인터가 포함 되어 있습니다.A reference type contains a pointer to data stored elsewhere in memory. 값 형식에는 고유한 데이터가 포함 됩니다.A value type contains its own data.