RecognizerInfo.Culture 属性

定义

获取 SpeechRecognizerSpeechRecognitionEngine 实例支持的区域性。

public:
 property System::Globalization::CultureInfo ^ Culture { System::Globalization::CultureInfo ^ get(); };
public System.Globalization.CultureInfo Culture { get; }
member this.Culture : System.Globalization.CultureInfo
Public ReadOnly Property Culture As CultureInfo

属性值

返回有关给定的 SpeechRecognizerSpeechRecognitionEngine 实例支持的区域性的信息。

示例

以下示例实现一个按钮单击,该按钮单击显示实例中的所有 RecognizerInfo 信息。 该示例使用 Culture 属性获取识别引擎配置使用的 的标识字符串 CultureInfo

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));  
}  

注解

CultureInfo对象可以包括区域性的名称、关联的语言、国家/地区、使用的日历,以及如何设置日期格式和对字符串进行排序。

适用于

另请参阅