本文整理汇总了C#中System.EnterpriseServices.ApplicationQueuingAttribute类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationQueuingAttribute类的具体用法?C# ApplicationQueuingAttribute怎么用?C# ApplicationQueuingAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationQueuingAttribute类属于System.EnterpriseServices命名空间,在下文中一共展示了ApplicationQueuingAttribute类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplicationQueuingAttribute_Enabled
//引入命名空间
using System;
using System.EnterpriseServices;
using System.Reflection;
// References:
// System.EnterpriseServices
[assembly: ApplicationQueuing]
public class ApplicationQueuingExample : ServicedComponent
{
public void ApplicationQueuingAttribute_Enabled()
{
// This example code requires that an ApplicationQueuing attribute be
// applied to the assembly, as shown below:
// [assembly: ApplicationQueuing]
// Get the ApplicationQueuingAttribute applied to the assembly.
ApplicationQueuingAttribute attribute =
(ApplicationQueuingAttribute)Attribute.GetCustomAttribute(
System.Reflection.Assembly.GetExecutingAssembly(),
typeof(ApplicationQueuingAttribute),
false);
// Display the current value of the attribute's Enabled property.
Console.WriteLine("ApplicationQueuingAttribute.Enabled: {0}",
attribute.Enabled);
// Set the Enabled property value of the attribute.
attribute.Enabled = false;
// Display the new value of the attribute's Enabled property.
Console.WriteLine("ApplicationQueuingAttribute.Enabled: {0}",
attribute.Enabled);
}
public void ApplicationQueuingAttribute_QueueListenerEnabled()
{
// This example code requires that an ApplicationQueuing attribute be
// applied to the assembly, as shown below:
// [assembly: ApplicationQueuing]
// Get the ApplicationQueuingAttribute applied to the assembly.
ApplicationQueuingAttribute attribute =
(ApplicationQueuingAttribute)Attribute.GetCustomAttribute(
System.Reflection.Assembly.GetExecutingAssembly(),
typeof(ApplicationQueuingAttribute),
false);
// Display the current value of the attribute's QueueListenerEnabled
// property.
Console.WriteLine(
"ApplicationQueuingAttribute.QueueListenerEnabled: {0}",
attribute.Enabled);
// Set the QueueListenerEnabled property value of the attribute.
attribute.QueueListenerEnabled = false;
// Display the new value of the attribute's QueueListenerEnabled
// property.
Console.WriteLine(
"ApplicationQueuingAttribute.QueueListenerEnabled: {0}",
attribute.QueueListenerEnabled);
}
public void ApplicationQueuingAttribute_MaxListenerThreads()
{
// This example code requires that an ApplicationQueuing attribute be
// applied to the assembly, as shown below:
// [assembly: ApplicationQueuing]
// Get the ApplicationQueuingAttribute applied to the assembly.
ApplicationQueuingAttribute attribute =
(ApplicationQueuingAttribute)Attribute.GetCustomAttribute(
System.Reflection.Assembly.GetExecutingAssembly(),
typeof(ApplicationQueuingAttribute),
false);
// Display the current value of the attribute's MaxListenerThreads
// property.
Console.WriteLine(
"ApplicationQueuingAttribute.MaxListenerThreads: {0}",
attribute.MaxListenerThreads);
// Set the MaxListenerThreads property value of the attribute.
attribute.MaxListenerThreads = 1;
// Display the new value of the attribute's MaxListenerThreads
// property.
Console.WriteLine(
"ApplicationQueuingAttribute.MaxListenerThreads: {0}",
attribute.MaxListenerThreads);
}
}