codebeginnerg
Member
- Joined
- Oct 13, 2014
- Messages
- 6
- Programming Experience
- Beginner
I've been having a hard to writing a simpler and/or condense way of rewriting this method. This is a method used in c#. Is there a way to simply or condense this code to make it more simpler to comprehend?
C#:
private void prepareToPrint()
{
teams.Clear();// Clearing the list of teams
//Storing the teams and information in the List
foreach (DataRowView row in bindingSource1.List)
{
//Checking if information is true
if ((combobox1.Text == "All Teams" || combobox1.Text == row["Home Team"].ToString()
|| combobox1Text == row["Away Team"].ToString())
&& (DateTime)row["Game_Date"] >= datebeg.Value &&
(DateTime)row["Game_Date"] <= dateEnd2.Value)
{
short hScore = (short)row["Home Pts Scored"];
short aScore = (short)row["Away Pts Scored"];
string home = row["Home Team"].ToString();
string away = row["Away Team"].ToString();
DateTime date = (DateTime)row["Game_Date"];
teamInfo teamStuff = new teamInfo(hScore, aScore, home, away, date);
teams.Add(teamStuff);
}
}
}