本文整理汇总了C#中ApiClient.GetQuestions方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.GetQuestions方法的具体用法?C# ApiClient.GetQuestions怎么用?C# ApiClient.GetQuestions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.GetQuestions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testquestions
public void testquestions()
{
var creds = File.ReadAllLines(@"C:\tmp\sg_creds.txt");
var apiClient = new ApiClient() { ApiToken = creds[0], ApiTokenSecret = creds[1] };
Func<QuestionOptions[], string> joinOptions = (options) => options != null && options.Length > 0
? "\noptions :\n" + string.Join(",\n\n", options.Select(o => o.title.English)) +
",\n"
: "";
var questions = apiClient.GetQuestions(2687802).Where(q => q._type == "SurveyQuestion").ToList();
var gizmoQuestions = questions.Select(q => new
{
ID = q.id.ToString(),
Question = q.title != null ? q.title.English + joinOptions(q.options) : "",
QCode =
q.properties != null && q.properties.question_description != null &&
q.properties.question_description.English != null
? HtmlRegex.Replace(q.properties.question_description.English, string.Empty)
: "",
AnswerFormat = q._subtype ?? ""
}).ToList();
foreach (var gizmoQuestion in gizmoQuestions)
{
Trace.WriteLine(gizmoQuestion.QCode);
}
}