共用方式為


SemanticValue.Value 屬性

定義

一個只讀性質,回傳目前 SemanticValue中包含的資訊。

public:
 property System::Object ^ Value { System::Object ^ get(); };
public object Value { get; }
member this.Value : obj
Public ReadOnly Property Value As Object

屬性值

回傳 Object 包含目前 SemanticValue 實例中資訊的實例。

範例

以下範例用於遞迴遍歷並顯示資訊(包括信心值),作為 TreeNodeCollection,或作為組成語意結構中用來辨識片語的樹狀結構的節點。

internal static void CreateSemanticsTreeNodes(
          TreeNodeCollection nodes,
          SemanticValue semantics,
          String name)
{
  string semanticsText =
      String.Format("  {0} ( Confidence {1})", name,semantics.Confidence);

  // Format integers as hexadecimal.
  if (semantics.Value == null )
  {
    semanticsText = semanticsText + " = null";
  }
  else if (semantics.Value.GetType() == typeof(int))
  {
    semanticsText = String.Format("{0} = {1:X} ", semanticsText, semantics.Value);
  }
  else
  {
    semanticsText = semanticsText + " = " + semantics.Value.ToString();
  }

  TreeNode semanticsNode = new TreeNode(semanticsText);
  foreach (KeyValuePair<String, SemanticValue> child in semantics)
  {
    CreateSemanticsTreeNodes(semanticsNode.Nodes, child.Value, child.Key);
  }
  nodes.Add(semanticsNode);
}

備註

未使用語意解析的識別結果總是具有 和 ValuenullCount 的 和 的性質為零。

適用於