RecognizerInfo.Id 属性

定义

获取 SpeechRecognizerSpeechRecognitionEngine 实例的标识符。

public:
 property System::String ^ Id { System::String ^ get(); };
public string Id { get; }
member this.Id : string
Public ReadOnly Property Id As String

属性值

String

返回特定 SpeechRecognizerSpeechRecognitionEngine 实例的标识符。

示例

下面的示例实现了一个单击按钮,该按钮显示实例中的所有信息 RecognizerInfo 。 该示例使用 Id 属性获取识别引擎配置的标识符字符串,然后将其显示在中 MessageBox

private void recognizerInfoButton_Click(object sender, EventArgs e)   
{  
  RecognizerInfo info = _recognizer.RecognizerInfo;  
  string AudioFormats = "";  
  foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)   
  {  
    AudioFormats += String.Format("       {0}\n",  fmt.EncodingFormat.ToString());  
  }  
  string AdditionalInfo = "";  
  foreach (string key in info.AdditionalInfo.Keys)   
  {  
    AdditionalInfo += String.Format("      {0}: {1}\n", key, info.AdditionalInfo[key]);  
  }  
  MessageBox.Show(String.Format(  
                           "Name:                 {0 }\n" +  
                           "Description:          {1} \n" +  
                           "SupportedAudioFormats:\n" +  
                           "{2} " +  
                           "Culture:              {3} \n" +  
                           "AdditionalInfo:       \n" +  
                           " {4}\n",  
                           info.Name.ToString(),  
                           info.Description.ToString(),  
                           AudioFormats,  
                           info.Culture.ToString(),  
                           AdditionalInfo));  
}  

注解

属性返回的标识符与 Id Windows 注册表中识别引擎的标记名称相同。

适用于

另请参阅