You can try this using LINQ:
List Branches = new List();
Branches.Add(1);
Branches.Add(2);
Branches.Add(3);
XElement xmlElements = new XElement("Branches", Branches.Select(i => new XElement("branch", i)));
System.Console.Write(xmlElements);
System.Console.Read();
Output:
1
2
3
Forgot to mention: you need to include using System.Xml.Linq;
namespace.
EDIT:
XElement xmlElements = new XElement("Branches", Branches.Select(i => new XElement("branch", new XAttribute("id", i))));
output: