PrivateComponentAttribute Classe
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
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à
- Attributi
Nell'esempio di codice seguente viene illustrato l'uso del PrivateComponentAttribute 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
Per altre informazioni sull'uso degli attributi, vedere Attributi.
Private |
Inizializza una nuova istanza della classe PrivateComponentAttribute. |
Type |
Quando è implementata in una classe derivata, ottiene un identificatore univoco della classe Attribute. (Ereditato da Attribute) |
Equals(Object) |
Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. (Ereditato da Attribute) |
Get |
Restituisce il codice hash per l'istanza. (Ereditato da Attribute) |
Get |
Ottiene l'oggetto Type dell'istanza corrente. (Ereditato da Object) |
Is |
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) |
Memberwise |
Crea una copia superficiale dell'oggetto Object corrente. (Ereditato da Object) |
To |
Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) |
_Attribute. |
Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch. (Ereditato da Attribute) |
_Attribute. |
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. |
Recupera il numero delle interfacce di informazioni sul tipo fornite da un oggetto (0 o 1). (Ereditato da Attribute) |
_Attribute. |
Fornisce l'accesso a proprietà e metodi esposti da un oggetto. (Ereditato da Attribute) |
Prodotto | Versioni |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: