c# - WPF comparing strings in separate files -


I have 2 files with a CSV file and the other is a text file. I need to know that I want to know whether the contained strings contained in the CSV file are present in the text file or not. After doing this check, I want to add those CSV strings which are present in the INMemable collection in the text file which I will use for binding. For example, if CSV Connets "AA", "BB", "CC" and "BB", "EE", "FF", "CC", "BB" in my text "BB", "CC" Should be "bb" I have made a start by reading the CSV file using code below. Can any solution provide PLS? Thanks - Ben

  public class VM {public VM} {words = load word (file path); } Public IEnumerable & lt; String & gt; Word (get; private set;) string filePath = @ "Z: \ My document \ Words.csv"; Private static IEnumerable & lt; string & gt; load word (string filespath) {list & lt; string & gt; Word = new list & lt; string & gt; (); {foreach (try string line in file (file path)} {string [] rows = line. Try (','); words.AddRange (lines) );}} Hold (Exception e) {System.Windows.MessageBox.Show (e.Message);} Return word;}}    

You can do this with LINQ, h By the way:

  var csv = new [] {"AA", "BB", "CC"}; var text = new [] {"BB", "EE", "FF" , "CC", "BB"}; IEnumerable & lt; string & gt; CollectionToBind = text.Where (t = & gt; csv.Contains (t));    < / Html>

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -