HomeHomeDiscussionsDiscussionsGeneralGeneraladd dictionary of questions and print one by one in Dialogs using Chain.Posttochain()add dictionary of questions and print one by one in Dialogs using Chain.Posttochain()
Previous
 
Next
New Post
4/3/2017 5:34 PM
 

Hi Everyone,

Need to add questions in dictionary and print one by one using Dialog using chain mechanism.

Kindly help me.

 var quiz = Chain
                .PostToChain()
                .Select(_ => "how many questions?")
                .PostToUser()
                .WaitToBot()
                .Select(m => int.Parse(m.Text))
                .Select(count => Enumerable.Range(0, count).Select(index => Chain.Return($"question {index + 1}?").PostToUser().WaitToBot().Select(m => m.Text)))
                .Fold((l, r) => l + "," + r)
                .Select(answers => "your answers were: " + answers)
                .PostToUser();
            //    .Loop();
            return quiz;

Here in the above code instead of index want to put some dictionary values and print the questions one by one .

Is that possible? I have tried but I'm getting the exception

Exception: anonymous method closures that capture the environment are not serializable, consider removing environment capture or using a reflection serialization surrogate: LuisBot.Dialogs.EchoChainDialog+<>c__DisplayClass2_0

Kindly help me

 
Previous
 
Next
HomeHomeDiscussionsDiscussionsGeneralGeneraladd dictionary of questions and print one by one in Dialogs using Chain.Posttochain()add dictionary of questions and print one by one in Dialogs using Chain.Posttochain()