Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Has been moved not relevant The content must be at least 30 characters

What I have tried:

.....................

That's the code I am using right now but it is flawed.
Posted
Updated 14-Dec-16 18:21pm
v5
Comments
Philippe Mori 7-Sep-16 21:02pm    
Your question is not clear. Provide more complete example of what you want to do including input and output files. I do understand why loops are nested nor why you write one file per inner iteration but that file does not seems to depends on outer loop.
Philippe Mori 7-Sep-16 21:04pm    
By the way, it is hard to understand the question since code does not do what you tell in the question. If the code does not works as expected, then you should tell what you get and what you expect from that code.
ZurdoDev 7-Sep-16 21:22pm    
Why is it flawed and why can't you fix it?
Karthik_Mahalingam 8-Sep-16 0:03am    
are you saving each line in xml file?

1 solution

I think that what you are saying is that you have two text boxes, FindTxtbx and ReplaceWithTxtbx. I am not sure what "(MultiLine)" means but I think you are saying that in your example you want to replace "Task" with "SomeNamedTask" and "Enabled" with "Value".

There are many ways to do it. One way is to first create an array of structs and the each struct will have just two members, the text from a FindTxtbx line and the corresponding text from the ReplaceWithTxtbx line.

Use File.ReadAllText to read all the text into a string.

Then do a foreach for the array and do the replace to replace the find text with the replacewith text. Since the line separator will still be in the data, you don't need to go line-by-line, you can do the replace for all the text at once for each replacewith text.
 
Share this answer
 
Comments
Sam Hobbs 8-Sep-16 0:51am    
So was everything I said wrong and a total waste of time?

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