0

How do I pass the KeyValuePair into this method, accepting ICollection<KeyValuePair<string, string>>?

enter image description here

If my header name is 'auth' and the header value is 'local'

_restActions.ExecutePostRequest(resource, body, {WHAT GOES HERE});
Guru Stron
  • 102,774
  • 10
  • 95
  • 132
JLee101
  • 93
  • 1
  • 1
  • 8

2 Answers2

3

You can pass a Dictionary<string, string> which implements ICollection<KeyValuePair<string, string>> and, I would argue, allows the most concise instantiation syntax:

_restActions.ExecutePostRequest(
    resource, 
    body, 
    new Dictionary<string, string>{{"one", "two"}, {"foo", "bar"}});
Guru Stron
  • 102,774
  • 10
  • 95
  • 132
1

You do not need to pass anything since there is null on headers parameter (default value). If you do want to pass something then it would be anything like new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("content-type", "text/plain") }

labilbe
  • 3,501
  • 2
  • 29
  • 34