GrammarBuilder.Implicit 연산자

정의

다른 형식을 .로 GrammarBuilder변환합니다.

오버로드

Name Description
Implicit(Choices to GrammarBuilder)

개체를 Choices 개체로 GrammarBuilder 변환합니다.

Implicit(SemanticResultKey to GrammarBuilder)

개체를 SemanticResultKey 개체로 GrammarBuilder 변환합니다.

Implicit(SemanticResultValue to GrammarBuilder)

개체를 SemanticResultValue 개체로 GrammarBuilder 변환합니다.

Implicit(String to GrammarBuilder)

문자열을 개체로 GrammarBuilder 변환합니다.

설명

암시적 변환은 새 인스턴스를 GrammarBuilder만듭니다. 다음 클래스를 각각에 캐스팅할 GrammarBuilder수 있습니다.

각 암시적 캐스트는 생성자를 호출하는 것과 같습니다.

Implicit(Choices to GrammarBuilder)

Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs

개체를 Choices 개체로 GrammarBuilder 변환합니다.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::Speech::Recognition::Choices ^ choices);
public static implicit operator System.Speech.Recognition.GrammarBuilder(System.Speech.Recognition.Choices choices);
static member op_Implicit : System.Speech.Recognition.Choices -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (choices As Choices) As GrammarBuilder

매개 변수

choices
Choices

변환할 대안 집합입니다.

반품

변환된 Choices 개체입니다.

예제

다음 예제에서는 "예" 또는 "아니요" 질문에 대한 응답을 인식할 수 있는 음성 인식 문법을 만듭니다. 암시적 변환 연산자는 개체에서 SemanticResultValue 개체를 Choices 생성하고, 두 Choices 개체에서 개체를 SemanticResultValue 생성하고, 개체에서 Grammar 개체를 SemanticResultKey 생성할 때 사용됩니다.

Choices yesChoices = new Choices(new string[] {"yes", "yup", "yah"});
SemanticResultValue yesValue =
  new SemanticResultValue(yesChoices, true);

Choices noChoices = new Choices(new string[] { "no", "nope", "nah" });
SemanticResultValue noValue =
  new SemanticResultValue(noChoices, false);

SemanticResultKey yesnoKey =
  new SemanticResultKey("yesno", new Choices(new GrammarBuilder[] { yesValue, noValue }));

Grammar yesnoGrammar = new Grammar(yesnoKey);
yesnoGrammar.Name = "yesno";

설명

암시적 변환은 새 인스턴스를 GrammarBuilder만듭니다. 이 변환 연산자는 에 대한 GrammarBuilder호출 choices 및 지정과 alternateChoices 동일합니다.

이 연산자에 해당하는 메서드는 다음과 같습니다. GrammarBuilder.GrammarBuilder(Choices)

추가 정보

적용 대상

Implicit(SemanticResultKey to GrammarBuilder)

Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs

개체를 SemanticResultKey 개체로 GrammarBuilder 변환합니다.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::Speech::Recognition::SemanticResultKey ^ semanticKey);
public static implicit operator System.Speech.Recognition.GrammarBuilder(System.Speech.Recognition.SemanticResultKey semanticKey);
static member op_Implicit : System.Speech.Recognition.SemanticResultKey -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (semanticKey As SemanticResultKey) As GrammarBuilder

매개 변수

semanticKey
SemanticResultKey

변환할 의미 체계 키입니다.

반품

변환된 SemanticResultKey 개체입니다.

예제

다음 예제에서는 "예" 또는 "아니요" 질문에 대한 응답을 인식할 수 있는 음성 인식 문법을 만듭니다. 암시적 변환 연산자는 개체에서 SemanticResultValue 개체를 Choices 생성하고, 두 Choices 개체에서 개체를 SemanticResultValue 생성하고, 개체에서 Grammar 개체를 SemanticResultKey 생성할 때 사용됩니다.

Choices yesChoices = new Choices(new string[] {"yes", "yup", "yah"});
SemanticResultValue yesValue =
  new SemanticResultValue(yesChoices, true);

Choices noChoices = new Choices(new string[] { "no", "nope", "nah" });
SemanticResultValue noValue =
  new SemanticResultValue(noChoices, false);

SemanticResultKey yesnoKey =
  new SemanticResultKey("yesno", new Choices(new GrammarBuilder[] { yesValue, noValue }));

Grammar yesnoGrammar = new Grammar(yesnoKey);
yesnoGrammar.Name = "yesno";

설명

암시적 변환은 새 인스턴스를 GrammarBuilder만듭니다. 이 변환 연산자는 에 대한 GrammarBuilder호출 semanticKey 및 지정과 key 동일합니다.

이 연산자에 해당하는 메서드는 다음과 같습니다. GrammarBuilder.GrammarBuilder(SemanticResultKey)

추가 정보

적용 대상

Implicit(SemanticResultValue to GrammarBuilder)

Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs

개체를 SemanticResultValue 개체로 GrammarBuilder 변환합니다.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::Speech::Recognition::SemanticResultValue ^ semanticValue);
public static implicit operator System.Speech.Recognition.GrammarBuilder(System.Speech.Recognition.SemanticResultValue semanticValue);
static member op_Implicit : System.Speech.Recognition.SemanticResultValue -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (semanticValue As SemanticResultValue) As GrammarBuilder

매개 변수

semanticValue
SemanticResultValue

SemanticResultValue 변환할 개체입니다.

반품

변환된 SemanticResultValue 개체입니다.

예제

다음 예제에서는 "예" 또는 "아니요" 질문에 대한 응답을 인식할 수 있는 음성 인식 문법을 만듭니다. 암시적 변환 연산자는 개체에서 SemanticResultValue개체를 Choices 생성하고, 두 Choices 개체에서 개체를 SemanticResultValue 생성하고, 개체에서 Grammar 개체를 SemanticResultKey 생성할 때 사용됩니다.

Choices yesChoices = new Choices(new string[] {"yes", "yup", "yah"});
SemanticResultValue yesValue =
  new SemanticResultValue(yesChoices, true);

Choices noChoices = new Choices(new string[] { "no", "nope", "nah" });
SemanticResultValue noValue =
  new SemanticResultValue(noChoices, false);

SemanticResultKey yesnoKey =
  new SemanticResultKey("yesno", new Choices(new GrammarBuilder[] { yesValue, noValue }));

Grammar yesnoGrammar = new Grammar(yesnoKey);
yesnoGrammar.Name = "yesno";

설명

암시적 변환은 새 인스턴스를 GrammarBuilder만듭니다. 이 변환 연산자는 에 대한 GrammarBuilder호출 semanticValue 및 지정과 value 동일합니다.

이 연산자에 해당하는 메서드는 다음과 같습니다. GrammarBuilder.GrammarBuilder(SemanticResultValue)

추가 정보

적용 대상

Implicit(String to GrammarBuilder)

Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs
Source:
GrammarBuilder.cs

문자열을 개체로 GrammarBuilder 변환합니다.

public:
 static operator System::Speech::Recognition::GrammarBuilder ^(System::String ^ phrase);
public static implicit operator System.Speech.Recognition.GrammarBuilder(string phrase);
static member op_Implicit : string -> System.Speech.Recognition.GrammarBuilder
Public Shared Widening Operator CType (phrase As String) As GrammarBuilder

매개 변수

phrase
String

변환할 문자열입니다.

반품

변환된 문자열입니다.

예제

다음 예제에서는 "배경 GrammarBuilder 만들기" 또는 "background를 Choices로 설정"이라는 두 구 중 하나를 인식할 수 있는 문법을 생성하기 위해 사용 및 개체를 사용합니다.

개체를 사용하여 Choices에 허용되는 값 목록을 만든 후 이 예제에서는 두 GrammarBuilder 개체를 초기화하고 makePhrase문자열 개체 setPhrase 에서 암시적 변환을 사용합니다.

이 예제에서는 마지막으로 개체에서 Grammar 개체로 캐스팅된 Choices 개체를 GrammarBuilder 만듭니다.

private Grammar CreateColorGrammar()
{

  // Create a set of color choices.
  Choices colorChoice = new Choices(new string[] {"red", "green", "blue"});
  GrammarBuilder colorElement = new GrammarBuilder(colorChoice);

  // Create grammar builders for the two versions of the phrase.
  GrammarBuilder makePhrase = new GrammarBuilder("Make background");
  makePhrase.Append(colorElement);
  GrammarBuilder setPhrase = new GrammarBuilder("Set background to");
  setPhrase.Append(colorElement);

  // Create a Choices for the two alternative phrases, convert the Choices
  // to a GrammarBuilder, and construct the Grammar object from the result.
  Choices bothChoices = new Choices(new GrammarBuilder[] {makePhrase, setPhrase});
  Grammar grammar = new Grammar((GrammarBuilder)bothChoices);
  grammar.Name = "backgroundColor";
  return grammar;
}

설명

암시적 변환은 새 인스턴스를 GrammarBuilder만듭니다. 이 변환 연산자는 동일한 호출 GrammarBuilder 및 지정과 phrase동일합니다.

이 연산자에 해당하는 메서드는 다음과 같습니다. GrammarBuilder.GrammarBuilder(String)

추가 정보

적용 대상