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

C#

 
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 
AnswerRe: Creating a list of complex object from two lists Pin
Dan Mos10-Mar-10 7:29
Dan Mos10-Mar-10 7:29 
GeneralRe: Creating a list of complex object from two lists Pin
dan!sh 10-Mar-10 7:45
professional dan!sh 10-Mar-10 7:45 
AnswerRe: Creating a list of complex object from two lists Pin
Keith Barrow10-Mar-10 9:23
professionalKeith Barrow10-Mar-10 9:23 
GeneralRe: Creating a list of complex object from two lists Pin
Dan Mos10-Mar-10 10:26
Dan Mos10-Mar-10 10:26 
GeneralRe: Creating a list of complex object from two lists Pin
dan!sh 10-Mar-10 16:56
professional dan!sh 10-Mar-10 16:56 
QuestionHow installer can call non-System account action? Pin
dims1210-Mar-10 6:03
dims1210-Mar-10 6:03 
QuestionHow to use CutePDF Writer programmatically Pin
NarVish10-Mar-10 5:53
NarVish10-Mar-10 5:53 
AnswerRe: How to use CutePDF Writer programmatically Pin
JHizzle10-Mar-10 6:01
JHizzle10-Mar-10 6:01 

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.