Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Modifying a 'method' which contains a lambda expression will prevent the debug session from continuing while Edit and Continue is enabled.

How to solve this problem while using lambda expression?



Thanks in advance
Posted
Updated 26-Jun-14 4:18am
v3
Comments
[no name] 26-Jun-14 9:55am    
Okay, so why are you unable to split the paragraph then iterate through the resulting array to see if the array element contains the word you are looking for?
[no name] 26-Jun-14 10:26am    
Okay so now why are changing your "question" to something completley different so that the answers you already have make no sense? And, the answer to this question is to stop trying to make changes to expressions when you are trying to debug them.
Sergey Alexandrovich Kryukov 26-Jun-14 14:19pm    
This is just the illustration of the problem with lambda expression: "modifying the string which contains a question will prevent the answer from being valid". :-)
To me, this is not even a problem: there will also be some programming techniques which cannot be debugged using some existing debugger.
—SA

1 solution

Well, it depends.
If this is just "in a string" then it's complex; strings don't have any real built in sense of "lines", just of a "line separator" character: '\n'

One way to do it is to get the index of the word - which is trivial - and then count the number of "lines" in the string up to that point. But...there is not built in way to count lines either! This should help you find the lines count: Counting Lines in a String[^] - it presents quite a few ways, which are (mostly) easy to modify to only work on a substring without generateing new strings all the time.
 
Share this answer
 
Comments
agent_kruger 26-Jun-14 9:32am    
no sir, i have updated the question please see to that. I want the whole line where the word exists.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900