【发布时间】:2018-07-08 19:51:09
【问题描述】:
我是以下代码:
var token = new JwtBuilder()
.WithAlgorithm(new HMACSHA256Algorithm())
.WithSecret(_Signature)
.AddClaim("test", 3)
.Build();
我想添加多个值(此处称为“声明”):
.AddClaim("test", 3)
.AddClaim("test2", 4)
.AddClaim("test3", 5)
如果我有字典:
Dictionary<string, int> myDictionary;
如何编写表达式以便添加字典中的所有值? (伪代码:AddClaim(myDictionary))。
编辑: 我正在寻找一种适合“流畅”流程而不是外部循环的方法。
【问题讨论】: