以前見かけたコードの中に「ラムダ式からPOSTメソッドのパラメータを生成する」というメソッドがあり、非常に便利なので多少手を加えたものを流用させてもらっている。 private static FormUrlEncodedContent CreatePostContent(params Expression<Func<Object, Object>>[] exprs) { var contents = new List<KeyValuePair<string, string>>(); foreach (var expr in exprs) { var obj = expr.Compile().Invoke(null); if (obj == null) continue; if (obj is Byte[]) { contents.Add(new KeyValuePair<string, s