-
October 17th, 2012, 11:34 PM
#1
foreach loop
Hi All,
I have something like this..
foreach(Location location in locationList)
{
studentList.Add(new StudentDataList() {Locationcode = location .locationcode};
}
IntializeStudentDataValues(studentList);
Private void IntializeStudentDataValues(List<StudentDataList> studentList)
{
if(studentList != null)
{
foreach(var student in studentList)
{
switch(student .StudentName.ToUpper())
{
case "A":
//Do Something
Case "B":
//DoSomething
}
}
}
}
i am having "IntializeStudentDataValues" for having foreach loop for "studentList". Instead of this i would like to have one foreach where i have it for locationList. I want to write one foreach for both cases. I want perform
switch case in this foreach(Location location in locationList).
Can anybody help me on this?
Thanks,
genith
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|