This documentation is archived and is not being maintained.

PrivateComponentAttribute Class

Identifies a component as a private component that is only seen and activated by components in the same application. This class cannot be inherited.

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

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class, Inherited := True)> _
<ComVisibleAttribute(False)> _
Public NotInheritable Class PrivateComponentAttribute _
	Inherits Attribute
'Usage
Dim instance As PrivateComponentAttribute

For more information about using attributes, see Extending Metadata Using Attributes.

The following code example shows the use of the PrivateComponentAttribute type.

Imports System
Imports System.EnterpriseServices
Imports System.Reflection


' References: 
' System.EnterpriseServices 

' Note: Access checks must be performed at the component level to allow access 
' to private components.

<assembly: ApplicationAccessControl(False, AccessChecksLevel := AccessChecksLevelOption.ApplicationComponent)>


<PrivateComponent()>  _
Public Class PrivateComponentAttribute_Example
    Inherits ServicedComponent

    Public Sub Example() 
        ' Display some output.
        MsgBox("Private component called successfully.")

    End Sub 'Example
End Class 'PrivateComponentAttribute_Example

Public Class PrivateComponentAttribute_Test
    Inherits ServicedComponent

    Public Sub Test() 
        ' Create a new instance of the example class. 
        Dim example As New PrivateComponentAttribute_Example()

        ' Call a method on the class.
        example.Example()

    End Sub 'Test
End Class 'PrivateComponentAttribute_Test

System.Object
  System.Attribute
    System.EnterpriseServices.PrivateComponentAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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: