how to group data in a list c#
- by prince23
hi,
i need to group data of a list in c#
ex: i have a data like this in a list c#
i have a class called information.cs with these properties name,school, parent
ex data
name school parent
kumar fes All
manju fes kumar
anu frank kumar
anitha jss All
rohit frank manju
anill vijaya manju
vani jss kumar
soumya jss kumar
madhu jss rohit
shiva jss rohit
vanitha jss anitha
anu jss anitha
now taking this as an input i wanted the output to be formated with a Hierarchical data
when parent is all means it is the topmost level
kumar fes All.
what i need to do here is i need to create an object[0] and then check in list whether kumar exists as a parent in the list if it exista then add those items as under the object[0] as a parent
i need to create one more oject under
**manju fes kumar
anu frank kumar**
what i wanted do here is iterate through the list anD then check the parent level based on
name school parent
kumar fes All -->obj[0]
manju fes kumar -->obj1[0]
anu frank kumar -->obj1[1]
for obj1-- obj[0] will be parent like this i need to genarte a list or observation class
anitha jss All-->obj[1]
vanitha jss anitha -->obj1[0]
anu jss vanitha -->obj2[0]
here obj2[0]--obj1[0]--obj[1] will be an parent
like this i need to create a list or an observationclass hope my Question is clear what i am trying ask you people.
i wanted to know how i can create an observationclass
any help would be really great
thanks
prince
hope my question is clear