共用方式為


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 登錄中辨識引擎的權杖名稱相同。

適用於

另請參閱