below is the code i am using currently but wondering is there a better way of doing what i am doing… i am creating a-z model like A B C D E ….Z
any thoughts?
if (myEnum.MoveNext())
{
MyNames t = myEnum.Current;
if (t.Name.ToLower().StartsWith("a"))
{
if (_a == 0)
{
l = new Literal();
//.....
_a = 1;
}
}
if (t.Name.ToLower().StartsWith("b"))
{
if (_b == 0)
{
l = new Literal();
l.Text = "<h1 id='B'><span>B</span></h1>" + Environment.NewLine;
_b = 1;
}
}
.....c..d...e...f...g....z
}
You can also use “Aggregate” function provided with LINQ.