Swi-cs-pl - A CSharp class library to connect .NET languages with SWI-Prolog
Item Property (position)
SwiPlCs interfaceSbsSW.SwiPlCsPlTermItem[([( Int32])])

If PlTerm is compound and index is between 0 and Arity (including), the nth PlTerm is returned.

If pos is 0 the functor of the term is returned (For a list '.').

See: PL_get_arg/3

Declaration Syntax
C#Visual BasicVisual C++F#
public PlTerm this[
	int position
] { get; }
Public ReadOnly Default Property Item ( 
	position As Integer
) As PlTerm
	Get
public:
property PlTerm default[int position] {
	PlTerm get (int position);
}
member Item : PlTerm with get
Parameters
position (Int32)
To Get the nth PlTerm
Return Value
PlTerm
a PlTerm
Examples
 Copy imageCopy
[TestMethod]
public void PlTermIndexer2()
{
    PlTerm t = PlTerm.PlCompound("foo(bar, x(y))");
    Assert.AreEqual("foo", t[0].ToString());
    Assert.AreEqual("bar", t[1].ToString());
    Assert.AreEqual("x(y)", t[2].ToString());
}

[TestMethod]
public void PlTermIndexer_list1()
{
    PlTerm t = PlTerm.PlCompound("[a,b,c]");
    Assert.AreEqual(".", t[0].ToString());
    Assert.AreEqual("a", t[1].ToString());
    Assert.AreEqual("[b,c]", t[2].ToString());
}
Exceptions
ExceptionCondition
NotSupportedExceptionIs thrown if PlTerm is not of Type PlCompound see IsCompound
ArgumentOutOfRangeExceptionIs thrown if (pos < 0 || pos >= Arity)
InvalidOperationExceptionIs thrown if PL_get_arg returns 0.

Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60601.0 (1.1.60601.0)