Click here to Skip to main content
15,916,846 members
Home / Discussions / C#
   

C#

 
GeneralRe: How C# should communicate with access db file ? Pin
coding freaks10-Mar-10 20:02
coding freaks10-Mar-10 20:02 
GeneralRe: How C# should communicate with access db file ? Pin
Luc Pattyn10-Mar-10 17:34
sitebuilderLuc Pattyn10-Mar-10 17:34 
AnswerRe: How C# should communicate with access db file ? Pin
coding freaks10-Mar-10 20:17
coding freaks10-Mar-10 20:17 
QuestionText Files Pin
Darrall10-Mar-10 12:55
Darrall10-Mar-10 12:55 
AnswerRe: Text Files Pin
DaveyM6910-Mar-10 14:16
professionalDaveyM6910-Mar-10 14:16 
GeneralRe: Text Files Pin
Darrall10-Mar-10 14:36
Darrall10-Mar-10 14:36 
QuestionLooping through Dataset instead of DataGridView? Pin
Eagle3210-Mar-10 11:48
Eagle3210-Mar-10 11:48 
AnswerRe: Looping through Dataset instead of DataGridView? Pin
Dan Mos10-Mar-10 12:03
Dan Mos10-Mar-10 12:03 
GeneralRe: Looping through Dataset instead of DataGridView? Pin
Eagle3210-Mar-10 12:11
Eagle3210-Mar-10 12:11 
GeneralRe: Looping through Dataset instead of DataGridView?[modified] Pin
Dan Mos10-Mar-10 12:24
Dan Mos10-Mar-10 12:24 
GeneralRe: Looping through Dataset instead of DataGridView Pin
Som Shekhar10-Mar-10 18:13
Som Shekhar10-Mar-10 18:13 
GeneralRe: Looping through Dataset instead of DataGridView Pin
Eagle3211-Mar-10 12:02
Eagle3211-Mar-10 12:02 
GeneralRe: Looping through Dataset instead of DataGridView Pin
Som Shekhar11-Mar-10 18:06
Som Shekhar11-Mar-10 18:06 
QuestionClass properties - how to change values from form Pin
peropata10-Mar-10 10:32
peropata10-Mar-10 10:32 
AnswerRe: Class properties - how to change values from form Pin
Dan Mos10-Mar-10 10:44
Dan Mos10-Mar-10 10:44 
GeneralRe: Class properties - how to change values from form Pin
peropata10-Mar-10 11:46
peropata10-Mar-10 11:46 
GeneralRe: Class properties - how to change values from form Pin
Dan Mos10-Mar-10 12:10
Dan Mos10-Mar-10 12:10 
GeneralRe: Class properties - how to change values from form Pin
peropata10-Mar-10 19:54
peropata10-Mar-10 19:54 
QuestionC# dataset/adapter connection Pin
2010JohnFByers10-Mar-10 9:50
2010JohnFByers10-Mar-10 9:50 
AnswerRe: C# dataset/adapter connection Pin
Dan Mos10-Mar-10 10:09
Dan Mos10-Mar-10 10:09 
GeneralRe: C# dataset/adapter connection Pin
2010JohnFByers10-Mar-10 11:16
2010JohnFByers10-Mar-10 11:16 
GeneralRe: C# dataset/adapter connection Pin
Dan Mos10-Mar-10 11:30
Dan Mos10-Mar-10 11:30 
QuestionSet the SelectedItem of a populated DataGridViewComboBoxCell Pin
Member 226514810-Mar-10 7:44
Member 226514810-Mar-10 7:44 
QuestionCreating a list of complex object from two lists [modified] Pin
dan!sh 10-Mar-10 6:58
professional dan!sh 10-Mar-10 6:58 
Assume there are two classes: Zoo and Animals. Something like this:
public class Zoo{
public int Id;
public string Name;
public List< Animals > animals;
} 

public class Animals{
public int Id;
public string Name;
}


Now, I have two generic lists:

1. List of Zoo
2. List of Animals
3. Any kind of collection (I cannot decide which one to use) which will have Zoo.Id and Animal.Id. This collection would be used as a map between Zoo and Animals. Here each Zoo will have multiple animals and same animal can be a part of multiple zoos.

I need to get the list of Animals in a Zoo and then set that value to Zoo.animals list. I am thinking to use LINQ. Something like:

foreach(Zoo zoo in zooList){
zoo.animals = (from animal in animalList
               where collectionThree[animal.Id] = zoo.Id
               select animal).ToList();
}


But since collectionThree cannot be a Dictionary/HashTable, this wont work. Any ideas how to do this?
modified on Wednesday, March 10, 2010 10:56 PM

AnswerRe: Creating a list of complex object from two lists Pin
masoumeh201010-Mar-10 7:16
masoumeh201010-Mar-10 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.