This documentation is archived and is not being maintained.

Type.IsMarshalByRefImpl Method

Implements the IsMarshalByRef property and determines whether the Type is marshaled by reference.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Protected Overridable Function IsMarshalByRefImpl As Boolean
'Usage
Dim returnValue As Boolean 

returnValue = Me.IsMarshalByRefImpl()

Return Value

Type: System.Boolean
true if the Type is marshaled by reference; otherwise, false.

This method can be overridden by a derived class.

The following example determines whether the given type is marshaled by reference and displays the result.

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class MyTypeDelegatorClass
    Inherits TypeDelegator
    Public myElementType As String = Nothing 
    Private myType As Type = Nothing 
    Public Sub New(ByVal myType As Type)
        MyBase.New(myType)
        Me.myType = myType
    End Sub 'New 

    ' Override IsMarshalByRefImpl. 
    Protected Overrides Function IsMarshalByRefImpl() As Boolean 
        ' Determine whether the type is marshalled by reference. 
        If myType.IsMarshalByRef Then
            myElementType = " marshalled by reference" 
            Return True 
        End If 
        Return False 
    End Function 'IsMarshalByRefImpl
End Class 'MyTypeDelegatorClass

Public Class MyTypeDemoClass

    Public Shared Sub Main()
        Try 
            Dim myType As MyTypeDelegatorClass
            Console.WriteLine("Determine whether MyContextBoundClass is marshalled by reference.")
            ' Determine whether MyContextBoundClass is marshalled by reference.
            myType = New MyTypeDelegatorClass(GetType(MyContextBoundClass))
            If myType.IsMarshalByRef Then
                Console.WriteLine(GetType(MyContextBoundClass).ToString() + " is marshalled by reference.")
            Else
                Console.WriteLine(GetType(MyContextBoundClass).ToString() + " is not marshalled by reference.")
            End If 

            ' Determine whether int is marshalled by reference.
            myType = New MyTypeDelegatorClass(GetType(Integer))
            Console.WriteLine(ControlChars.NewLine + "Determine whether int is marshalled by reference.")
            If myType.IsMarshalByRef Then
                Console.WriteLine(GetType(Integer).ToString() + " is marshalled by reference.")
            Else
                Console.WriteLine(GetType(Integer).ToString() + " is not marshalled by reference.")
            End If 
        Catch e As Exception
            Console.WriteLine("Exception: {0}", e.Message.ToString())
        End Try 
    End Sub 'Main
End Class 'MyTypeDemoClass

' This class is used to demonstrate 'IsMarshalByRefImpl' method. 
Public Class MyContextBoundClass
    Inherits ContextBoundObject
    Public myString As String = "This class is used to demonstrate members of the Type class." 
End Class 'MyContextBoundClass

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: