Επεξεργασία

Κοινή χρήση μέσω


DefaultPropertiesToSend Constructor

Definition

Initializes a new instance of the DefaultPropertiesToSend class.

public:
 DefaultPropertiesToSend();
public DefaultPropertiesToSend ();
Public Sub New ()

Remarks

You can create a new instance of DefaultPropertiesToSend to define default property values to associate with objects sent to a queue that are not of type Message. When working with MessageQueue objects, a DefaultPropertiesToSend instance is created for you and associated with the MessageQueue.DefaultPropertiesToSend member of the MessageQueue.

There are two ways to define a queue's default properties to send, as shown in the following C# code. You can set values for this instance of DefaultPropertiesToSend and associate it with the queue's MessageQueue.DefaultPropertiesToSend property:

DefaultPropertiesToSend myDefaultProperties = new DefaultPropertiesToSend();  
  // Set default values for the properties.  
  myDefaultProperties.Label = "myLabel";  
  myDefaultProperties.Recoverable = false;  
 ...  
  myMessageQueue.DefaultPropertiesToSend = myDefaultProperties;  
  myMessageQueue.Send("hello");  

Or, you can individually assign values to the MessageQueue instance's DefaultPropertiesToSend property directly:

myMessageQueue.DefaultPropertiesToSend.Label = "myLabel";  
  myMessageQueue.DefaultPropertiesToSend.Recoverable = false;  
...  
  myMessageQueue.Send("hello");  

If you choose the second of these options, you do not need to call the DefaultPropertiesToSend constructor explicitly. You might want to create instances of DefaultPropertiesToSend, for example, if the properties' default values depend on some criterion of the message being sent. You can create multiple DefaultPropertiesToSend instances and assign one to the queue's MessageQueue.DefaultPropertiesToSend property before sending the message to the queue.

The following table shows initial property values for an instance of DefaultPropertiesToSend.

Property Initial value
AcknowledgeType AcknowledgeTypes.None
AdministrationQueue null
AppSpecific 0
AttachSenderId true
EncryptionAlgorithm EncryptionAlgorithm.RC2
Extension A zero-length array of bytes
HashAlgorithm HashAlgorithm.MD5
Label An empty string ("")
Priority MessagePriority.Normal
Recoverable false
ResponseQueue null
TimeToBeReceived Message.InfiniteTimeout
TimeToReachQueue Message.InfiniteTimeout
TransactionStatusQueue null
UseAuthentication false
UseDeadLetterQueue false
UseEncryption false
UseJournalQueue false
UseTracing false

Applies to

See also