Share via


QuestionAnswerActivity.Answers Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Gets the collection of semantic items that this QuestionAnswerActivity answers.

Namespace: Microsoft.SpeechServer.Dialog
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)

Syntax

'Declaration
<GlobalizedCategoryAttribute("SpeechCategory")> _
<GlobalizedDescriptionAttribute("QuestionAnswerActivity_Answers")> _
<TypeConverterAttribute("Microsoft.SpeechServer.Authoring.DialogDesigner.EditFromCodeBesideStringConverter, Microsoft.SpeechServer.Authoring.DialogDesigner, Version=2.0.3400.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")> _
Public ReadOnly Property Answers As SemanticItemCollection
[GlobalizedCategoryAttribute("SpeechCategory")] 
[GlobalizedDescriptionAttribute("QuestionAnswerActivity_Answers")] 
[TypeConverterAttribute("Microsoft.SpeechServer.Authoring.DialogDesigner.EditFromCodeBesideStringConverter, Microsoft.SpeechServer.Authoring.DialogDesigner, Version=2.0.3400.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] 
public SemanticItemCollection Answers { get; }

Property Value

A SemanticItemCollection that contains the semantic items that this QuestionAnswerActivity answers.

Example

The following example is taken from the ConcertsSansFrontieres reference application. In this example, AdultTicketsSemanticItem and ChildTicketsSemanticItem are registered as instance dependency properties (see InstanceDependencyProperty). Within the TicketChooser method, two calls to the SetValue method associate the previously mentioned instance dependency properties with semantic items for, respectively, the number of adult tickets and the number of child tickets. Finally, AdultTicketsSemanticItem and ChildTicketsSemanticItem are added to, respectively, the Answers property on askAdultSeats and askChildrenSeatsQuestionAnswerActivity instances.

private static readonly InstanceDependencyProperty AdultTicketsSemanticItemProperty = InstanceDependencyProperty.Register("AdultTicketsSemanticItem", typeof(SemanticItem<long>), typeof(TicketChooser));
private static readonly InstanceDependencyProperty ChildTicketsSemanticItemProperty = InstanceDependencyProperty.Register("ChildTicketsSemanticItem", typeof(SemanticItem<long>), typeof(TicketChooser));

private ResourceManager _resourceManager;

public TicketChooser()
{
  InitializeComponent();

  // These values need to be set only once, as they are language independent. 
  // We can therefore put the initialization code in the constructor.
  // Other properties are set in the Initialize method which is called before each execution.
  SetValue(AdultTicketsSemanticItemProperty, new SemanticItem<long>(this, "adultTickets"));
  SetValue(ChildTicketsSemanticItemProperty, new SemanticItem<long>(this, "childTickets"));

  askAdultSeats.Answers.Add(AdultTicketsSemanticItem);
  askChildrenSeats.Answers.Add(ChildTicketsSemanticItem);
  confirmSeats.Confirms.Add(AdultTicketsSemanticItem);
  confirmSeats.Confirms.Add(ChildTicketsSemanticItem);
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

Windows Server 2003

See Also

Reference

QuestionAnswerActivity Class
QuestionAnswerActivity Members
Microsoft.SpeechServer.Dialog Namespace