Iterate dictionary object efficiently in c# with pre defined keys?
I believe you can do this if you put the header keys inside an array, and then you can loop over the array itself, and use TryGetValue for the dictionary. 

This is the simplest form for it : 

public readonly string[] HeaderKeys = {
    "header-abc", 
    "header-pqr", 
    "header-def", 
    "header-hip"
}

for(var x = 0; x &lt; HeaderKeys.Length; x++)
{
    var isKeyExist = values.TryGetValue(HeaderKeys[x], var KeyValue);

    // if there is no key defined, just go to the next iteration.
    if(!isKeyExist) { continue; }   

    switch (HeaderKeys[x])
    {
      case "header-abc":
          // inline assigning
          HeadOne = HeadOneId = KeyValue; 
          break;
      case "header-pqr":
          HeadTwo = HeadTwoId = KeyValue;
          break;
      case "header-def":
          HeadThree = HeadThreeId = KeyValue;
          break;
      case "header-hip":
          HeadFour = HeadFourId = KeyValue;
          break;
      //.. bunch of other case block here with similar stuff
    }
}


You need a readonly string[] this way, it can't be changed once initialized. System.Array is the lightest, and yet the simplest array, so using for loop with it would give you the fastest iteration over any other collection type. 

Next, you only want to pass each header key to the TryGetValue and get the value. The TryGetValue would return true if the value has been out, and false if there is none. 

Then, you have one line if condition : 

    // if there is no key defined, just go to the next iteration.
    if(!isKeyExist) { continue; }   


This would skip any iteration if the result of TryGetValue is false. 
And I believe that string.IsNullOrWhiteSpace(KeyValue) is an extra unneeded work. So, I got rid of it. because even if the KeyValue is null or empty, the variables would be also null. So, at this stage you're just assigning variables, the other validation would be on other part of the current system where it needs to be critical to have a value. 

Now, assigning the variables like this :  

HeadOne = KeyValue;
HeadOneId = HeadOne;


can be simplified to this : 

HeadOne = HeadOneId = KeyValue;


the difference is that the first one would let the compiler read the value twice. While the second would read it once, and assign it twice.