PrivateComponentAttribute 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 PrivateComponentAttribute 类的新实例。
public:
PrivateComponentAttribute();
public PrivateComponentAttribute ();
Public Sub New ()
示例
下面的代码示例创建新的 PrivateComponentAttribute。
// 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.");
}
};
// 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.");
}
}
' 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