title: Can i make this code much simpler and much smaller? c#
body: <p>As you can see in the code bellow , i have 3 foreach statements and its kinda big code i think. The main difference is only in <code>FieldName</code>. I hope someone can make it simpler..</p>
  
  <pre><code>string fieldname;
  string fieldLabel = "";
  
  foreach (var u in data)
  {
      fieldname = "field" + tag.getName() + "[" + msg.getMtId().getMessageType() + "]" + ".name";
      if (u.Key == fieldname)
      {
          fieldLabel = u.Value.ToString();
      }
  }
  
  if (fieldLabel == "")
  {
      fieldname = "field" + tag.getName() + ".name";
      foreach (var u in data)
      {
          if (u.Key == fieldname)
          {
              fieldLabel = u.Value.ToString();
          }
          if (fieldLabel == "")
          {
              fieldname = "field" + tag.getName() + ".name";
          }
      }
  }
  
  if (fieldLabel == "")
  {
      fieldname = "field" + tag.getName()+ "[" + msg.getMtId().getMessageType() + "]" + ".components";
      foreach (var u in data)
      {
          if (u.Key == fieldname)
          {
              fieldLabel = u.Value.ToString();
          }
      }
  }
  </code></pre>