DefaultPropertiesToSend Construtor

Definição

Inicializa uma nova instância da classe DefaultPropertiesToSend.Initializes a new instance of the DefaultPropertiesToSend class.

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

Comentários

Você pode criar uma nova instância do DefaultPropertiesToSend para definir valores de propriedade padrão para associar a objetos enviados a uma fila que não são do tipo Message .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. Ao trabalhar com MessageQueue objetos, uma DefaultPropertiesToSend instância é criada para você e associada ao MessageQueue.DefaultPropertiesToSend membro do MessageQueue .When working with MessageQueue objects, a DefaultPropertiesToSend instance is created for you and associated with the MessageQueue.DefaultPropertiesToSend member of the MessageQueue.

Há duas maneiras de definir as propriedades padrão de uma fila para enviar, conforme mostrado no código C# a seguir.There are two ways to define a queue's default properties to send, as shown in the following C# code. Você pode definir valores para essa instância do DefaultPropertiesToSend e associá-la à propriedade da fila MessageQueue.DefaultPropertiesToSend :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");  

Ou, você pode atribuir valores individualmente à MessageQueue propriedade da instância DefaultPropertiesToSend diretamente: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");  

Se você escolher a segunda dessas opções, não precisará chamar o DefaultPropertiesToSend Construtor explicitamente.If you choose the second of these options, you do not need to call the DefaultPropertiesToSend constructor explicitly. Talvez você queira criar instâncias do DefaultPropertiesToSend , por exemplo, se os valores padrão das propriedades dependerem de algum critério da mensagem que está sendo enviada.You might want to create instances of DefaultPropertiesToSend, for example, if the properties' default values depend on some criterion of the message being sent. Você pode criar várias DefaultPropertiesToSend instâncias e atribuir uma à propriedade da fila MessageQueue.DefaultPropertiesToSend antes de enviar a mensagem para a fila.You can create multiple DefaultPropertiesToSend instances and assign one to the queue's MessageQueue.DefaultPropertiesToSend property before sending the message to the queue.

A tabela a seguir mostra os valores de propriedade inicial para uma instância do DefaultPropertiesToSend .The following table shows initial property values for an instance of DefaultPropertiesToSend.

PropriedadeProperty Valor inicialInitial value
AcknowledgeType AcknowledgeTypes.None
AdministrationQueue null
AppSpecific 00
AttachSenderId true
EncryptionAlgorithm EncryptionAlgorithm.RC2
Extension Uma matriz de comprimento zero de bytesA zero-length array of bytes
HashAlgorithm HashAlgorithm.MD5
Label Uma cadeia de caracteres vazia ("")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

Aplica-se a

Confira também