jlucben
Pro
Posts: 27
Joined: Wed Oct 12, 2016 1:54 pm

Access in SIML to variable value as Tuples

Mon Oct 31, 2016 10:07 pm

HI

Is it possible to access in SIML to Variable value as Tuples ?
In your tuto example How can we access to USA :

<Variable Name="countries-codes">
<Value>United States|USA</Value>
<Value>Australia|AUS</Value>
<Value>Russian|RUS</Value>
<Value>Germany|DEU</Value>
<Value>Poland|POL</Value>
<Value>India|IND</Value>
</Variable>

And if Yes what is the syntax ?

Thanks for your help

Regards

User avatar
Fantom
Help & Support
Posts: 304
Joined: Fri Oct 25, 2013 9:20 pm

Re: Access in SIML to variable value as Tuples

Mon Oct 31, 2016 10:34 pm

yup there is a syntax, the SIML interpreter actually makes use of Syn.VA to inherit tuple extension.

CSharp Code

var variable = Bot.Settings["Countries-Code"];
foreach (var item in variable.GetTuples<string,string>())
{
	var first = item.Item1;
	var second = item.Item2;
    Console.WriteLine($"{first}:{second}");
}

Just use .GetTuple or .GetTuples extension.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests