Click here to Skip to main content
15,911,785 members
Home / Discussions / C#
   

C#

 
QuestionProblem with C# 3.0 Collection and Object Initializers [modified] Pin
User 665813-May-08 7:58
User 665813-May-08 7:58 
AnswerRe: Problem with C# 3.0 Collection and Object Initializers Pin
Gareth H13-May-08 9:06
Gareth H13-May-08 9:06 
GeneralRe: Problem with C# 3.0 Collection and Object Initializers Pin
User 665813-May-08 9:13
User 665813-May-08 9:13 
GeneralRe: Problem with C# 3.0 Collection and Object Initializers Pin
Gareth H13-May-08 9:36
Gareth H13-May-08 9:36 
AnswerRe: Problem with C# 3.0 Collection and Object Initializers Pin
Ed.Poore13-May-08 10:20
Ed.Poore13-May-08 10:20 
GeneralRe: Problem with C# 3.0 Collection and Object Initializers Pin
User 665813-May-08 10:39
User 665813-May-08 10:39 
GeneralRe: Problem with C# 3.0 Collection and Object Initializers Pin
Ed.Poore13-May-08 11:14
Ed.Poore13-May-08 11:14 
QuestionHelp can't find how retrieve element in a list!! Pin
papy-boom13-May-08 5:34
papy-boom13-May-08 5:34 
hi everybody i got problem in making search in a list using delegate.
i got a list of article here is my class article


public class Article <br />
{<br />
public Article();<br />
public List<Component> Components { get; set; }<br />
public int ID;<br />
}<br />
 <br />
here is my class Component<br />
public class Component<br />
{<br />
public Component(); <br />
public int Quantity { get; set; }<br />
}

using this code to make search it works

List <Article> ListResult = ListArticle.FindAll(delegate(Article art) { return art.ID == 99; });It works i got all articles with the ID equals to 99
but when i m trying to do filter in components i got a problem in compiling this code

List <Article> ListResult = ListArticle.FindAll(delegate(Article art)<br />
{<br />
for (int i = 0; i< art.Component.Count; i++)<br />
{<br />
return art.Component[i].Quantity.Equals(20);<br />
}<br />
});

I want to search in all article and in the collection of Component to retrieve those who has Quantity=20

Thank you for help
AnswerRe: Help can't find how retrieve element in a list!! Pin
User 665813-May-08 7:41
User 665813-May-08 7:41 
AnswerRe: Help can't find how retrieve element in a list!! Pin
Christian Graus13-May-08 13:22
protectorChristian Graus13-May-08 13:22 
GeneralRe: Help can't find how retrieve element in a list!! Pin
papy-boom13-May-08 22:35
papy-boom13-May-08 22:35 
QuestionEnsure a parameter is not null Pin
-Dy13-May-08 5:20
-Dy13-May-08 5:20 
GeneralRe: Ensure a parameter is not null Pin
CPallini13-May-08 5:43
mveCPallini13-May-08 5:43 
AnswerRe: Ensure a parameter is not null Pin
User 665813-May-08 7:25
User 665813-May-08 7:25 
AnswerRe: Ensure a parameter is not null Pin
Dave Sexton13-May-08 10:43
Dave Sexton13-May-08 10:43 
GeneralRe: Ensure a parameter is not null Pin
Vikram A Punathambekar13-May-08 19:06
Vikram A Punathambekar13-May-08 19:06 
AnswerRe: Ensure a parameter is not null Pin
Christian Graus13-May-08 11:45
protectorChristian Graus13-May-08 11:45 
GeneralRe: Ensure a parameter is not null Pin
Malcolm Smart13-May-08 12:35
Malcolm Smart13-May-08 12:35 
GeneralRe: Ensure a parameter is not null Pin
Christian Graus13-May-08 13:23
protectorChristian Graus13-May-08 13:23 
GeneralRe: Ensure a parameter is not null Pin
S. Senthil Kumar13-May-08 17:36
S. Senthil Kumar13-May-08 17:36 
GeneralRe: Ensure a parameter is not null Pin
Vikram A Punathambekar13-May-08 19:08
Vikram A Punathambekar13-May-08 19:08 
GeneralRe: Ensure a parameter is not null Pin
Malcolm Smart13-May-08 21:24
Malcolm Smart13-May-08 21:24 
GeneralRe: Ensure a parameter is not null Pin
S. Senthil Kumar13-May-08 22:38
S. Senthil Kumar13-May-08 22:38 
GeneralRe: Ensure a parameter is not null Pin
Vikram A Punathambekar13-May-08 19:12
Vikram A Punathambekar13-May-08 19:12 
AnswerRe: Ensure a parameter is not null Pin
PIEBALDconsult13-May-08 13:23
mvePIEBALDconsult13-May-08 13:23 

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.