本文整理匯總了C#中System.EnterpriseServices.PrivateComponentAttribute類的典型用法代碼示例。如果您正苦於以下問題:C# PrivateComponentAttribute類的具體用法?C# PrivateComponentAttribute怎麽用?C# PrivateComponentAttribute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PrivateComponentAttribute類屬於System.EnterpriseServices命名空間,在下文中一共展示了PrivateComponentAttribute類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ApplicationAccessControl
//引入命名空間
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();
}
}