PrivateComponentAttribute Classe

Definizione

Identifica un componente come componente privato rilevato e attivato solo dai componenti nella stessa applicazione. La classe non può essere ereditata.

public ref class PrivateComponentAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class PrivateComponentAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type PrivateComponentAttribute = class
    inherit Attribute
Public NotInheritable Class PrivateComponentAttribute
Inherits Attribute
Ereditarietà
PrivateComponentAttribute
Attributi

Esempio

Nell'esempio di codice seguente viene illustrato l'uso PrivateComponentAttribute del tipo.

#using <System.EnterpriseServices.dll>

using namespace System;
using namespace System::EnterpriseServices;

// 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 ref class PrivateComponentAttributeExample : public ServicedComponent
{
public:
    void DisplayMessage()
    {
        // Display some output.
        Console::WriteLine("Private component called successfully.");
    }
};

public ref class PrivateComponentAttributeTest : public ServicedComponent
{
public:
    static void Test()
    {
        // Create a new instance of the example class.
        PrivateComponentAttributeExample^ example =
            gcnew PrivateComponentAttributeExample();

        // Call a method on the class.
        example->DisplayMessage();
    }
};
using System;
using System.EnterpriseServices;
using 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 : ServicedComponent
{
    public void Example()
    {
        // Display some output.
        Console.WriteLine("Private component called successfully.");
    }
}

public class PrivateComponentAttribute_Test : ServicedComponent
{
    public void Test()
    {
        // Create a new instance of the example class.
        PrivateComponentAttribute_Example example =
            new PrivateComponentAttribute_Example();

        // Call a method on the class.
        example.Example();
    }
}
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
End Class

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
End Class

Commenti

Per altre informazioni sull'uso degli attributi, vedere Attributi.

Costruttori

PrivateComponentAttribute()

Inizializza una nuova istanza della classe PrivateComponentAttribute.

Proprietà

TypeId

Quando è implementata in una classe derivata, ottiene un identificatore univoco della classe Attribute.

(Ereditato da Attribute)

Metodi

Equals(Object)

Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato.

(Ereditato da Attribute)
GetHashCode()

Restituisce il codice hash per l'istanza.

(Ereditato da Attribute)
GetType()

Ottiene l'oggetto Type dell'istanza corrente.

(Ereditato da Object)
IsDefaultAttribute()

In caso di override in una classe derivata, indica se il valore di questa istanza è il valore predefinito per la classe derivata.

(Ereditato da Attribute)
Match(Object)

Quando è sottoposto a override in una classe derivata, restituisce un valore che indica se questa istanza equivale a un oggetto specificato.

(Ereditato da Attribute)
MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Implementazioni dell'interfaccia esplicita

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch.

(Ereditato da Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo relative a un oggetto, che possono essere usate per ottenere informazioni sul tipo relative a un'interfaccia.

(Ereditato da Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Recupera il numero delle interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

(Ereditato da Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornisce l'accesso a proprietà e metodi esposti da un oggetto.

(Ereditato da Attribute)

Si applica a