Skip to content

ITuple Interface

sequenze edited this page Jun 9, 2017 · 11 revisions

Represents a strongly typed set of tuples that can be access through pattern matching.

Syntax

    public interface ITuple : IFields

Properties

                Name                   Description
Size Gets the cardinality of the ITuple.
Item[Int32] Gets or sets the field at the specified index.
IFields.Fields Gets or sets the array of fields contained within the tuple.

Remarks

ITuple is the base interface of all tuples.


Examples

The following example demonstrates the usage of ITuple when fetching data from a tuple space.

    static void Main(string[] args)
    {
        Space ts = new Space();

        ts.Put("Hello world!");
        ITuple result = ts.Query(typeof(string));
        ts.Put(result);
        IEnumerable<ITuple> results = ts.QueryAll(typeof(string));

        foreach (ITuple tuple in results)
        {
            Console.WriteLine("{0}", tuple[0]);
        }
        Console.Read();
    }
    /*
    The following is printed to the console:
    Hello world!
    Hello world!
    */

See Also

IFields, Tuple

Clone this wiki locally