find function of List
-
Sonia - what error is the compiler returning? I'll give you a hint - you should use == not = in the check, but the compiler would have told you this. You have to learn how to interpret compiler errors rather than reaching for CodeProject as soon as you get an error you've not seen before. This and the error you posted below could both have been found with a little bit of effort and research on your part.
Deja View - the feeling that you've seen this post before.
Problem is the following line of code. There is accuring an error. argument 1 cannot convert form annonymous method to predicate obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
Problem is the following line of code. There is accuring an error. argument 1 cannot convert form annonymous method to predicate obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Sonia - I've already told you what the answer is. Read the full text above.
Deja View - the feeling that you've seen this post before.
-
Problem is the following line of code. There is accuring an error. argument 1 cannot convert form annonymous method 1o predicate obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
I guessed that, it's just that, like always, you're guessing how the code should look instead of doing research, and making posts that don't give half way enough information to help people to help you. public class person { public string name; public int age; public person(string nam , int ag) { this.age = ag; this.name = nam; } } public class Program { public static void Main(string[] args) { List<person> obj = new List<person>(); obj.Add(new person("abc",22)); obj.Add(new person("ggbc1",12)); obj.Add(new person("ccc2",10)); obj.Add(new person("cabc3",12)); obj.Add(new person("bbbc4", 6)); Predicate<person> exists = delegate(person p1) { return p1.age == 12; }; person p = obj.Find(exists); } } } Note that find will only return one object, you can use FindAll to get a list back.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Sonia - what error is the compiler returning? I'll give you a hint - you should use == not = in the check, but the compiler would have told you this. You have to learn how to interpret compiler errors rather than reaching for CodeProject as soon as you get an error you've not seen before. This and the error you posted below could both have been found with a little bit of effort and research on your part.
Deja View - the feeling that you've seen this post before.
Mate, that was the least of her problems.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Problem is the following line of code. There is accuring an error. argument 1 cannot convert form annonymous method to predicate obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Sonia - I thought that I would see whether Google would have been able to answer your question. You know what? The first entry in the list matched your problem exactly. Why not try reaching for google rather than using us to help you compile your code? It'll help you become a better developer in the long run.
Deja View - the feeling that you've seen this post before.
-
Sonia - I thought that I would see whether Google would have been able to answer your question. You know what? The first entry in the list matched your problem exactly. Why not try reaching for google rather than using us to help you compile your code? It'll help you become a better developer in the long run.
Deja View - the feeling that you've seen this post before.
can i use two filters in the find statement , according to there should not be two return statements in a single block. But i have to set two where conditions to refine the record.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
Sonia - I thought that I would see whether Google would have been able to answer your question. You know what? The first entry in the list matched your problem exactly. Why not try reaching for google rather than using us to help you compile your code? It'll help you become a better developer in the long run.
Deja View - the feeling that you've seen this post before.
You think this hasn't been said to her before ? She's lucky I got interested enough in the fact I didn't know the solution off the top of my head. And yes, I googled and the first hit told me exactly what to do, so I mocked up a sample for my own benefit as much as hers. I love the idea of anonymous predicates, but I don't find myself searching lists often enough to really use them.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
can i use two filters in the find statement , according to there should not be two return statements in a single block. But i have to set two where conditions to refine the record.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Wow - you didn't listen to a thing he said, did you ? You have a function that returns bool. It's up to you, through the writing of actual code, to decide when that is true, or false. It can depend on as many different conditions as you like.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Wow - you didn't listen to a thing he said, did you ? You have a function that returns bool. It's up to you, through the writing of actual code, to decide when that is true, or false. It can depend on as many different conditions as you like.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
This time , i think u did not care to look the question carefully. the new question has nothing to do with the prior one.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
This time , i think u did not care to look the question carefully. the new question has nothing to do with the prior one.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
True - but it represents you ignoring what has been said to your countless times, not even thanking either of us for doing your job for you, and pressing on with the next thing you can't work out. I answered the question, didn't I ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Sonia - what error is the compiler returning? I'll give you a hint - you should use == not = in the check, but the compiler would have told you this. You have to learn how to interpret compiler errors rather than reaching for CodeProject as soon as you get an error you've not seen before. This and the error you posted below could both have been found with a little bit of effort and research on your part.
Deja View - the feeling that you've seen this post before.
Sorry Pete..... Thanks a Lot , :) For sorting out my problem.and one more thing , i am the luckiest one , for having discussion with the MVP Really :)Thanks a Lot
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
Sorry Pete..... Thanks a Lot , :) For sorting out my problem.and one more thing , i am the luckiest one , for having discussion with the MVP Really :)Thanks a Lot
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
You think this hasn't been said to her before ? She's lucky I got interested enough in the fact I didn't know the solution off the top of my head. And yes, I googled and the first hit told me exactly what to do, so I mocked up a sample for my own benefit as much as hers. I love the idea of anonymous predicates, but I don't find myself searching lists often enough to really use them.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
You think this hasn't been said to her before ?
I know that we've both told her this many times. If I search through her history, I can find countless examples where she's been told to learn the basics. I can only hope that one day she might have the sense to think "Wait a second. These guys do know what they are talking about."
Deja View - the feeling that you've seen this post before.
-
can i use two filters in the find statement , according to there should not be two return statements in a single block. But i have to set two where conditions to refine the record.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Why not try it? Rather than asking me to do your thinking for you, why not try it yourself. Honestly - it's as though you are being deliberately stupid.
Deja View - the feeling that you've seen this post before.
-
Christian Graus wrote:
You think this hasn't been said to her before ?
I know that we've both told her this many times. If I search through her history, I can find countless examples where she's been told to learn the basics. I can only hope that one day she might have the sense to think "Wait a second. These guys do know what they are talking about."
Deja View - the feeling that you've seen this post before.
-
and the problem is...... ???
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )